recordset editing

abbers_01

Registered User.
Local time
Today, 15:34
Joined
Aug 31, 2007
Messages
45
I have a timecard form and payroll form, the timecard form simply takes all the job information in and the payroll calculates all the regular time and overtime for a payperiod. I'd like the payroll form to update the the timecard table's fields regular time and ot time. From what I gather around here is I need to use recordset edit, but I'm quite new to this and not sure how this will work for me.

How would I find a recordset where the persons name = 'x' and the date= 'y', I could do this with dlookup, but that doesn't allow me to edit the value. I guess basically how do you target specific recordsets based on multiple criteria to edit.

Thanks for any help.
 
added note,
I've been trying to use SQL Update, with no luck and it seems like it should be quite simple. Is this not the right syntax to update a table?

Update TimeCard
Set [TimeCard.Regular Hours] = 0
WHERE [TimeCard.Employee] = Me.employeeTextBox And [Job Date] = Me.mondaytxt1

I get an error:
Compile error: Sub or function not defined
 
Compile Error?

Your pseudo code for updating a table is oke but you need to add some punctuations. I mean quotes and stuff.
Code:
dim strSql as string
strSql = "Update TimeCard Set [TimeCard.Regular Hours] = 0 " & _
  "WHERE [TimeCard.Employee] = " & Me.employeeTextBox & " And [Job Date] = " & Me.mondaytxt1
When you get the error you mentioned, look at the line which is highlighted. That's where you will find the sub or function that's not defined.
 
thanks for your revision, but that puts it into a string, now what do I do to execute that, I 've tried to make it a recordsource, and setting as a control source of a text box both didn't work. I'm clueless on how to get this to actually get called.
 
Execute in the current database using
Code:
currentdb.execute strSql
Enjoy!
 
I came across DoCmd.runsql which has worked great for me, the only thing issue now is every time it updates a record it gives me a warning, how if it is possible do i get rid of that warning?
 

Users who are viewing this thread

Back
Top Bottom