Hello All
I am writing a Timesheet Access app. about 20% into it because I could not find a good sample online. (if anyone has a good one let me know). Anyway I have the data entry screen going and it collects and populates the data into a table using SQL vb script. (see screen shot below).
I thought I would create a template for each type of worker eg electricians, instructors , mechanics etc. so that it populates the hours for the week saving them time typing it all in, but again the code is too long.
This is the code i am trying to use, but its not working.
Dim index As Integer
Dim Startvar As String
index = 1
Startvar = "Me.txtStartD" & index
Do While index <= 7 'this will do 7 rotations.
Startvar = "Me.txtStartD" & index
MsgBox Startvar
Startvar = "8"
index = index + 1
' Me.txtStartD1 = "8" original code
Me.txtLunchD1 = "0.5"
Me.txtOtherD1 = "0"
Me.txtFinishD1 = "16"
Loop
Check out the attached image, The "MsgBox Startvar" rotates and show the correct escalation of field names, (txtStartD1, txtStartD2, txtStartD3, txtStartD4, txtStartD5, txtStartD6, txtStartD7) but does not populate the form.
Any help would be appreciated. Once i get the field txtStartDx going I will do the other fields like txtlunchDx
If anyone would like to join me writing the next stages Approval, Rejection, Re-Approval and Reports let me know.
Thanking someone in advance.
Terry
I am writing a Timesheet Access app. about 20% into it because I could not find a good sample online. (if anyone has a good one let me know). Anyway I have the data entry screen going and it collects and populates the data into a table using SQL vb script. (see screen shot below).
I thought I would create a template for each type of worker eg electricians, instructors , mechanics etc. so that it populates the hours for the week saving them time typing it all in, but again the code is too long.
This is the code i am trying to use, but its not working.
Dim index As Integer
Dim Startvar As String
index = 1
Startvar = "Me.txtStartD" & index
Do While index <= 7 'this will do 7 rotations.
Startvar = "Me.txtStartD" & index
MsgBox Startvar
Startvar = "8"
index = index + 1
' Me.txtStartD1 = "8" original code
Me.txtLunchD1 = "0.5"
Me.txtOtherD1 = "0"
Me.txtFinishD1 = "16"
Loop
Check out the attached image, The "MsgBox Startvar" rotates and show the correct escalation of field names, (txtStartD1, txtStartD2, txtStartD3, txtStartD4, txtStartD5, txtStartD6, txtStartD7) but does not populate the form.
Any help would be appreciated. Once i get the field txtStartDx going I will do the other fields like txtlunchDx
If anyone would like to join me writing the next stages Approval, Rejection, Re-Approval and Reports let me know.
Thanking someone in advance.
Terry