Keep in mind this code is based off my notes and memory because I don't have access to the computer that this code is at right now. (there may be errors)
If there's a better way, please let me know!!
So the code works right now to do what I want it to do, with one last thing to figure out.
So the question is this:
When the criteria from record set one matches the criteria from record set two, how do I then go back to table 2 to update the "Operator" field?
Also, is there any way I could do all this without using DAO.recordset?
Thanks..
~Kit
If there's a better way, please let me know!!
So the code works right now to do what I want it to do, with one last thing to figure out.
Code:
Dim Date1 As Date
Dim Date2 As Date
Dim Tool As String
Dim rst As DAO.Recordset
Set rst = CurrentDB.Openrecordset("ToolCheckout_tbl")
Dim rs2 As DAO.Recordset
Do Until rst.EOF
Date1 = rst.Fields("CheckoutDate")
Date2 = rst.Fields("ReturnDate")
Tool = rst.Fields("Tool")
Set rs2 = CurrentDB.Openrecordset("WorkOrder_tbl")
Do Until rs2.EOF
If rs2.Fields("Tool") = Tool And _
rs2.Fields("JobDate") >= Date1 And _
rs2.Fields("JobDate") <= Date2 Then _
'Code goes here to update record of the second table so that Operator = Operator from table 1.
'the associated record from "WorkOrder_tbl" should have the "Operator" field updated from an
'empty value to the name of the operator from table 1.
'Basically, we identify that the job in table 2 was being worked on a date that fell on or
'between our date range that the tool was checked out to someone, and so we update that record to reflect this.
rs2.MoveNext
Loop
rs2.close
rst.MoveNext
Loop
rst.Close
So the question is this:
When the criteria from record set one matches the criteria from record set two, how do I then go back to table 2 to update the "Operator" field?
Also, is there any way I could do all this without using DAO.recordset?
Thanks..
~Kit