Hi all,
Please have a quick look at my awesome VBA code...
I'd like to be able insert another value into tblHours. The field name has already been setup as "Payment." The value is calculated as follows...
CStr(Box) * ( tblEmployee.[Hourly Rate] WHERE [Employee ID] = tblEmployee.[Hourly Rate] )
Now I'm not sure of the correct syntax but the below is the best I was able to come up with.
Now when I run this, the error is "Query input must contain at least one table or query"
Help?
Please have a quick look at my awesome VBA code...
Code:
strSQL = "INSERT INTO tblHours ( [Project ID], [Employee ID], TS_Date, TS_Hours ) VALUES (" & selectproject & ", Forms!frmEmployeeTimesheet!cboSelectName, " & CStr(datebox) & ", " & CStr(Box) & ");"
DoCmd.RunSQL strSQL
CStr(Box) * ( tblEmployee.[Hourly Rate] WHERE [Employee ID] = tblEmployee.[Hourly Rate] )
Now I'm not sure of the correct syntax but the below is the best I was able to come up with.
Code:
strSQL = "INSERT INTO tblHours ( [Project ID], [Employee ID], TS_Date, TS_Hours, [COLOR=Red]Payment [/COLOR]) VALUES (" & selectproject & ", Forms!frmEmployeeTimesheet!cboSelectName, " & CStr(datebox) & ", " & CStr(Box) & "[COLOR=Red], tblEmployee.[Hourly Rate] * " & Box & ") WHERE ( tblHours.[Employee ID] = Forms!frmEmployeeTimesheet!cboSelectName) ;"[/COLOR]
Help?
Last edited: