I've been playing around trying several different things to get this form to open to a specific record. So here's a little background first.
I have two forms, frmWorkOrders and frmService. The first form (frmWorkOrders) creates a record in two tables, tblWorkOrders and tblServiceRecord. The tables are linked (tblServiceRecord is the child table with a column called WorkOrderID that has a relationship to the ID field of tblWorkOrders). I got it where the control (button) I was using would open frmService to the correct record but I was unable to edit the record at all. So I messed around and broke the code where it's just not opening to the correct record anymore at all. And I'm just not entirely sure what the heck I did wrong. Here is the code to open frmService:
Private Sub cmdService_Click()
On Error GoTo cmdService_Click_Err
DoCmd.OpenForm "frmService", acNormal, , "WorkOrderID = " & Me!txtID, acNormal
DoCmd.Close acForm, "frmWorkOrders"
cmdService_Click_Exit:
Exit Sub
cmdService_Click_Err:
MsgBox Error$
Resume cmdService_Click_Exit
End Sub
With this code, the form opens but it doesn't go to the proper record. I had it originally as:
DoCmd.OpenForm "frmService", acNormal, , "WorkOrderID = " & Me!txtID, acFormEdit
This opens to the correct record, but when I attempt to change anything in the other fields Access fires back an error "ding" and nothing happens.