Help with updating multivalue field

Cyberg

New member
Local time
Today, 04:55
Joined
Oct 4, 2018
Messages
4
I am currently trying to build an Employee Time Sheet form which stores different Weekly_Wage values in one field which updates depending on what day is selected on either a check box or radio button. So far it works only for the first Value but not subsequent selections. Here's my code

Private Sub btnTotalWages_Click()
If Me.OptionSun.Enabled = True Then
Sunday = (Total_Hours * Pay_Rate) - Break_Taken
Weekly_Wages = Val(Sunday)

ElseIf Me.OptionMon.Enabled = True Then
m = Weekly_Wages
Monday = (Total_Hours * Pay_Rate) - Break_Taken
m = Val(Sunday + Monday)
m = Weekly_Wages

End If
End Sub



Thanks for looking
 
I don't use multivalued fields and I doubt if any other than beginner developers do. Microsoft dumbed down the user interface to make it easier for direct uses but it makes it harder in my opinion to work with from a coding point of view.

Check out this

To quote one para
You might wonder why Office Access 2007 allows you to store more than one value in a field, when most relational database management systems forbid this. The answer is that the database engine in Office Access 2007 doesn't actually store the values in a single field. Even though what you see and work with appears to be a single field, the values are actually stored independently and managed in hidden, system tables. The Access database engine handles this for you, automatically separating the data and bringing it back together again to surface the values in one field.
 
Thanks Cronk

I will try a different method. :)
 
"The different approach" is to create a separate table of (in your case) Weekly_Wage values. Presumably you have a unique autonumber ID for each Employee ie EmployeeID. Using a field with the same name in your WeeklyWage table links to tblEmployees.


Create a form showing Employees and a subform linked on EmployeeID to show the respective weekly wages for each employee.


It's so much easier this way creating queries and reports and for any coding as well.
 

Users who are viewing this thread

Back
Top Bottom