I have a form "frmInvoice" which has two combo box's "cboDate" and "cboJobNumber". Based on the selection of these two pieces of data, I want the form to populate with the corresponding information. The Form is based on a query which has tables (tblInvoice, tblInvoiceNumber, tblTickets, tblJob, tblCustomer) in it. I have the code that does the check, but I am unsure as to how I will change the Bookmark. The InvoiceNumber is what ties everything of importance here together. Here is where I am:
' Find the record that matches the control.
Dim rst As DAO.Recordset
Dim Db As Database
Set Db = CurrentDb()
Set rst = Db.OpenRecordset("tblInvoiceNumber", dbOpenTable) 'set rs to the forms recordsource
'check that we have got some records
If Not (rst.BOF And rst.EOF) Then
'move to first record
rst.MoveFirst
'Loop Through all records
Do Until rst.EOF
If rst("JobNumber") = Me.cboJobNumber And rst("WeekEndingDateShown") = Me.cboDate Then
'we have found the invoice, now set the record to current
!!!!HERE IS MY PROBLEM!!!!
Exit Do
End If
rst.MoveNext
Loop
End If
'CLEAN UP After Yourself
'Close the Recordset
rst.Close
Set rts = Nothing
This works perfectly, but every different way I try to update the bookmark for the form will not work. Thank you very much for any assistance you can give me.
' Find the record that matches the control.
Dim rst As DAO.Recordset
Dim Db As Database
Set Db = CurrentDb()
Set rst = Db.OpenRecordset("tblInvoiceNumber", dbOpenTable) 'set rs to the forms recordsource
'check that we have got some records
If Not (rst.BOF And rst.EOF) Then
'move to first record
rst.MoveFirst
'Loop Through all records
Do Until rst.EOF
If rst("JobNumber") = Me.cboJobNumber And rst("WeekEndingDateShown") = Me.cboDate Then
'we have found the invoice, now set the record to current
!!!!HERE IS MY PROBLEM!!!!
Exit Do
End If
rst.MoveNext
Loop
End If
'CLEAN UP After Yourself
'Close the Recordset
rst.Close
Set rts = Nothing
This works perfectly, but every different way I try to update the bookmark for the form will not work. Thank you very much for any assistance you can give me.