Modules & VBA :: Update Hourly Rates With Exceptions That Use A Different List Of Rates
Apr 4, 2014
tblTimeEntry records individual time slips for attorneys keeping track of their time. Each slip records the client, attorney, time, rate, and value (time * rate) of the slip.tblPeople holds all the timekeepers and their current rate. Their rates change once a year.tblCustomRate will hold the exceptions,
How I imagine tblCustomRate will be set up is as follows (and this may be how it's wrong):Columns for each timekeeper. Each record is a client entry. When a new time entry gets entered, as it gets saved into tblTimeEntry, it should check to see if the client number is one that has a record on tblCustomRate. If it does, it should find the column for the timekeeper and use that rate. could add columns to the tblPeople for each client that gets a custom rate and use IF statements to get it to add, but that's a lot of legwork and code for a few clients.
tblTimeEntry
TimeID (primary key)
ClientID
TKFN (Timekeeper First Name)
Rate
Value
If it matters, this is Access front end with SQL Express tables. It's few and far between that I set up new People and it would be few and far between that there would be any custom rates (currently, there would be 2 out of 2000). People's rates change, but the time slips they entered at their old rate should stay at their old rate. If they were only worth $100/hour in 2010, but now they're worth $200/hour, the 2010 slips stay at the $100/hour rate.
I got a chance to make some extra money outside of my usual job.
I am creating a billing system for a plumbing business. It's pretty easy and shouldn't take me long to do. The only thing is I'm not sure what to charge.
I am using a basic Order form and Order Details subform to capture my information. Customer is selected, then Products and Quantities are filled in... the subform calculates the total price. This all works great. Then I have a problem.
I have some national customers that require shipping to multi regions. I would need to select the regions and it has to calculate a new case cost for each product for each area. Could be up to 100 (10 products x 10 areas) new calculated prices.
Then for other customers, I will use just the case cost for the whole order (multiple products) and add one shipping fee to cover the drop. 3 products and only 1 fee added to the total.
Currently, my Order Form uses a Tab page and the Order Details are on the first tab. I could put the Shipping Info on the second tab, I just don't know how to add up to 10 different shipping regions to generate 10 new prices or the one drop fee to the total price.
Never tried complicated formulas in Access and at a bit of a loss... What I am trying to do is calculate a utility bill based on stepped rates.
For example:
Usage up to the first 500KHW is billed at .067 per KWH Usage after the first 500KWH from 501 to 999 is billed at .044 per KWH Usage from 1000 up is billed at .0318
So if my usage was 1200 KWH...
((500 x .067)+(500 x .044)+(200 x .0318)) = 61.86
I was assuming it would require an complex "if" function to split the 1200 into steps and then calculate charges per step?
I have created a make table query and using expressions for two of the fields. I have set the field properties (format) to "Percent". The expressions are calculating rates based on two other fields. The expressions are currently as such:
I am trying to make a report in which I can see the amount of money that I have to pay weekly to an employee. To explain myself clearer, I have different rates for each employee. For example:
NameNormalPayRateVacationPayRateSickPayRateOvertimePayRateStandbyPayRate John Smith$15$10$15$30$8 Ken Jonson$10$8$10$20$8
I am doing this in a query. So what I want to be able to do is, for example, take 4 hours that the employee worked at NormalPayRate and multiply it. But if tomorrow the employee worked at a different rate, for example 3 hours overtime, I want those 3 hours multiplied by OvertimePayRate.
The way I saw it on my Google researches, is that they have only one rate and the amount will be [SumOfHours]*[Rate]. But how can I tell my query to skip, for example, one rate because the employee didn't work at that rate that day. So I can have different amount for the different rates.
By the way, entering the information I can divide at what rate the employee worked x day. So if the employee work 6 hours at regular, and later on 4 hours at standby, I have those information separated in my table.
Results that I am getting: I can easily get the amount in money multiplying the whole hours by a rate, so my result in my report will be multiplied by the same rate.
The coding below works fine. It presents a form with a list box of counties. Allows the user to select ALL, one or several counties and returns a query containing the clients from those counties.
The fields showing in the query are First, Last, Add1, FLAGToMap, City, Prov and Sector_Name.
I want to add in there a choice to select only the records that have are TRUE (-1) in the FLAGToMap field - just like the ALL button, this would be an ALL Selected Button let's say.
I would not know where to begin as I copied and adapted the coding below from a sample database and don't understand - at all - how the query is generated. The only coding in the form is the one below.
Private Sub cmdOpenQuery_Click() On Error GoTo Err_cmdOpenQuery_Click Dim MyDB As DAO.Database Dim qdef As DAO.QueryDef Dim i As Integer Dim strSQL As String
I have a combo box which gets its values from sql server using a query which is called "get_query_reason", which works fine. Now I want to update combo box values based on a user selection, st string. Have written the code, but does not work:
Dim qDef As QueryDef Dim Query As String Dim st As String Dim rs As Recordset st = "SOV" Set qDef = CurrentDb.QueryDefs("get_query_reason")
I have database with an userform called AssignWP, combobox called WPDevBy, listbox called List352 (Multi select) and table called Justified.I am trying to update one field WPDevelopedBy of the table as combobox value based on list box multi selected records.
I am needing a database that will help to manage employee leave (holiday) requests. I have one but the current design is a bit...... well, you know.
Leave Limits are (presently) applied by one table:- tblLimit ------- payWeek workType (twentysix work types some common to all sites, some apply only to one or two sites) LimitSiteA (three sites) LimitSiteB LimitSiteC LimitAllSites
So, several "faults" are immediately apparent:
LimitAllSites is ALWAYS the sum of LimitSiteA+LimitSiteB+LimitSiteC so clearly shouldn't be there, and I don't even want to talk about that....
Also , no primary key, repeating columns... uh-oh! Therfore.... tblLimit ------- limitID (PK) payWeek (date/time - always a Wednesday, our payWeek begins on a Wednesday) workTypeID (FK to new table tblWorkType) siteID (FK to new table tblSite) Limit (integer)
However....with just a brief investigation, it transpires that of the 1600+ rows in this (current version) table, there are only 69 unique sets of limits (ran a Unique Values query, excluding the PayWeek).
So, what I do want to talk about is not having to add in a table row for each WorkType for each PayWeek (for each site- with the improved design). I want to apply a general set of limits, with effectiveFrom and effectiveTo dates, per Site/workType combination, which should automatically populate out 80 weeks into the future (historical records are not required - it is just to help plan future leave) and then cater for the exceptions by "adjusting" the general limits in one of two ways: 1) every day over a date range (e.g. every day between 15NOV05 and 15DEC05, decrease the limit for worktype Z in Site A by 10 percent of the BASE* limit). 2) every nominated weekday over a date range (e.g. every Friday in December 2005, increase the limit for worktype Z in Site A by 20 percent of the BASE limit).
*the two adjustment types need to be independent, overlappable, and have a cumulative effect.
e.g. for the above, if the general limit for type Z of site A were 100 14 NOV --> limit 100 = 100 (no adjustment) 15 NOV --> limit 100-10 = 90 (adjustment per #1) . . - repeat concept as above . 30 NOV --> limit 100-10 = 90 (adjustment per #1) 01 DEC --> limit 100-10 = 90 (adjustment per #1) 02 DEC --> (Friday) --> limit 100-10+20 = 110 (adjustment per #1 & #2) 03 DEC --> limit 100-10 = 90 (adjustment per #1) . . - repeat concept as above . 15 DEC --> limit 100-10 = 90 (adjustment per #1) 16 DEC --> (Friday) --> limit 100+20 = 120 (adjustment per #2) 17 DEC --> limit 100 = 100 (no adjustment) etc
It gets dirtier ! There are two broad types of leave - general - for which the limit is determined/applied at the (site+workType) level, and "long service" for which the limit is to be applied at just the site level (workType has no bearing).
I was OK up until it got "dirtier" - now I am not so sure....
I was thinking...
tblLimit (base limits) ------- limitID (PK) workTypeID (FK to new table tblWorkType) siteID (FK to new table tblSite) limit (integer) effectiveFrom (date/time) effectiveTo (date/time)
Does my base limit table store WorkTypeID, but as null when the record relates to "long service" leave, and as a valid WorkTypeID when the record relates to "general" leave ? If so, is it of sound design to derive the broad leave type from the "nullness" of the workTypeID, or is it recommended to store that separately?
Similar questions relate to the adjustment table, for both WorkTypeID and WeekdayID...
I have a normal schedule table in my database that stores the open/close hours for each business unit location.
The problem is some locations are timeshares and some have different business units every other week, every 2 Tuesday, the 1st and 3rd weeks of the month.
I figured I would make an exception table noting all of these somehow and after building a calendar/report plug in the exceptions.
Is there any way to force a field value to be unique and of a set length, but with exceptions?
Let me explain... I have a text field in my table called "employee_number" and this value is always one of the following:
NULL an 8-digit number the word "External"
What I want to do is to force that field to either be NULL, the word "External", or a unique 8-digit number.
Is this possible? Obviously I can't set the source field in SQL to accept unique values only but I wondered if there was any way around it at form level?
I am self-taught on Access and have designed a quite basic database for a friend who owns his own company. This is a client contact database designed to hold information about his clients and their companies, but also to send reminders to Outlook when they haven't been contacted for a while - ie. to make my friend more proactive in his business.
This was a project which I originally agreed to work on for a fixed price. Needless to say, I undersold myself and probably because I am self-taught, with the number of hours I have put in, I probably got paid 2p an hour!
The project is drawing to a close, but he wants to pay me per hour for any further development to the system, and for any similar work he wants doing, problem is I haven't a clue what to charge him per hour?
Any ideas, without divulging your well-earned salaries of course!
I'm asked to do a specific task, a database concerning of:Tables: 25Forms: 25Reports: 40-45Build from ground up, multi-user, accounts, account-restrictions, has to be linked to an already existing database, will need a fair amount of VBA coding.I would like to know specifically two things:--> what is your common hourly rate --> what would your common total-price-estimate for a project like this.
I currently have a continuous form in my database that has 24 records in it. every record is blank except for a time (I will post a screenshot)
Our employees are instructed to enter various information every hour in this form. coding a button that, when clicked, will create 24 new records in the table that this form is based on, insert times in those 24 records, and then display those 24 records in the form. It would have the illusion that the end user it "resetting" the form at the end of his shift and preparing a clean form for the next person.
In the spreadsheet that we currently use, there is a button that, when pressed, saves the workbook with the date in its file name and then clears all of the end-user's data so that the next shift has a clean spreadsheet to use. I would like to mimic this button as closely as possible in MS Access
I understand that this database design is not exactly ideal in the world of database engineering; however, I was told to make this a perfectly seamless transition from the excel spreadsheet we currently use (there is a folder with 900+ workbooks from over the years. This obviously makes the information useless - we need all of the information in one file - this database)
We recently have had a change to our hourly rate that we pay and now the Totals calculation is not adding up the numbers correctly.
In the query that the report is based from:
ExtendedTotal: CCur([Hours]*[Rate])
In the footer of the report: (Provides a Total for each Day)
Sub-Total: "Control Source" is: =Sum(CCur([ExtendedTotal]))
Report Footer: (Provides a Grand Total for the Month) Total: "Control Source" is: =Sum([ExtendedTotal])
Problem comes in with the odd dollar rate time partial hours. For example:
$9.73 x 4.5 hours = $43.785 (Rounds to $43.79) which is fine...
but when you have a whole column of these rounded numbers, the totals are coming out off by pennies which add up to a good bit at the end of the month. I cannot match up the totals with the invoices that are coming in either.
I've got a single table with multiple fields, three of which are a date field ('DDate'), a time field ('TimeET') and a unique identifying field ('Unique Call Key'). I'm attempting to write a query in the QBE that will allow me to count the number of instances of 'UniqueCallKey' for each hourly time interval (7:00:00 AM - 7:59:59 AM, 8:00:00 AM - 8:59:59 AM, 9:00:00 - 9:59:59 AM, etc) for any selected date range (BETWEEN 'DDate'(1) AND 'DDate'(2)). When I try to simply use the Count function on 'UniqueCallKey' as an Expression and 'TimeET' with 'Like '7:*AM' as a Where criteria then do the same with another instance of 'UniqueCallKey' and 'Like 8:*AM' as the criteria for a second Where criteria for 'TimeET' the query returns an empty set. What I'm trying to accomplish would be a column of dates, a second column that counts the number of instances of 'UniqueCallKey' at the 7AM interval for each date in column 1, a third column that counts the number of instances of 'UniqueCallKey' at the 8AM interval for each date in column 1, etc to a final column for counts at 7PM.
I am creating an input form to assign an engineer to a project for x days.
The form consists of two Text Boxes for the Engineer Code and Project Name. I also have a Multi Select List Box which is linked to a table. The Table contains two fields ID-Autonumber and Date-ShortDate. This table contains all dates for the next three years.
I ideally want the user to select the Engineer Code and Project and the desired dates the engineer is to be assigned and add these to another table.
I have tried the following code but while the two Text Boxes update fine and the number of selected dates are added the dates themselves are not.
Can anyone see where I am going wrong and guide me in the right direction
Private Sub Command4_Click() On Error GoTo Err_Command4_Click
Dim db As ADODB.Connection Dim r As ADODB.Recordset Set db = CurrentProject.Connection Set r = New ADODB.Recordset
For Each var In Me.List0.ItemsSelected r.MoveLast r.AddNew r.Fields("Date") = Me.List0.Value r.Fields("EngineerCode") = Me.EngineerCode.Value r.Fields("Project") = Me.Project.Value r.Update Next var
I have a list box which is bound to a field in a table - however, when I select a value (which comes from a lookup query) it is not writing the value to the table, which is basically making my database useless!
I've also tried using an update query using the following code (before trying this I made the list box unbound):
UPDATE tblgroup SET tblgroup.Price = [Forms]![frmMain].[lstPrice].[value] WHERE (((tblgroup.Group)=[forms]![frmMain].[txtGroup].[value]));
I have a private sub on a subform called txtsearchstring_change.
The txtsearchstring box is = to the client_id on the main form.
Basically when the user clicks on the next record button (which is on the main form) it should update the txtsearchstring_change on the subform and then display the new results in the list box.
Im not to sure how to do this. I understand im calling a sub from another form, so i did try a public not a private sub. And i have added on the next and previous button - txtsearchstring_change.
When I add something that is not current in the recordsource for the combo I still get the msg box: "is not on the list, Do you want to add it? click yes or no. I click yes and then I now get this error: "The text you entered isn't an item in the list. Select an item from the list or enter text that matches one of the listed items"
As I said earlier the NotOnListEvent worked just great until I added the AfterUpdate Event. Any suggestions for me? Thanks in advance
The Source Table is updating but the Table the Form populates is not updating.
Please help. This is driving me crazy. and thanks!
I have a form in Access 2002 that a field contains a Listbox of States (US states). If I neglect to click into the listbox and alter the state name and then leave the form, I will get no entry. There an item on the list highlighted each time the form is opened. I would like the highlighted list item to act as it was selected, and then become the value stored in the field. But, I can't seem to figure out a way to ensure this happens.
hello all i have a problem, i have a form bounded to a query that displays the books infos, in this form i have a list control that displays the list of authos based on the code of the book the problem is when i have more than one record in the opened form ie more than one book and i move to the second record the list doesnt change and displays the authors of the first book when the form first opened anyone has an idea how can the list be updated automatically when i move between records thanks a lot
I have a list box on a continous form that dynamically pulls it's information by why of a query where a field in the query is equal to the value of a field on the form.
The problem is it only does it for the first record and every record after that has values based on the first record. Is it possible for the list box to show different values for each record or is there an alternative method of pulling the information.