My form was working fine but needed changes to the subform structure, so I did that but now my add new record option doesn't work. I get the error You can't go to the specified record.
I don't know if something else in my code is causing this but this is the only place it stops:
So basically if the user selects New from the option box, it should add a new record using the WO_ID field. If the user selects Update, then the combo box displays to select an existing record.
The subform shows related records using the Site_ID field.
thanks.
I don't know if something else in my code is causing this but this is the only place it stops:
Code:
Private Sub optWO_Add_AfterUpdate()
On Error GoTo Err_optWO_Add_AfterUpdate
Select Case optWO_Add
Case 1 'option 1 - add a new Work Order
cboWO_ID.Visible = False
WO_ID.Visible = True
cboSITE.Visible = True
cboSITE.Value = ""
WO_SITE.Visible = False
WO_ACTIVE.Value = 1
DoCmd.GoToRecord , , acNewRec 'this is where i get the error
Case 2 'Update an existing work order
cboWO_ID.Visible = True
cboWO_ID.Requery
WO_ID.Visible = False
cboSITE.Visible = False
WO_SITE.Visible = True
End Select
Exit_optWO_Add_AfterUpdate:
Exit Sub
Err_optWO_Add_AfterUpdate:
MsgBox Err.Description
Resume Exit_optWO_Add_AfterUpdate
End Sub
So basically if the user selects New from the option box, it should add a new record using the WO_ID field. If the user selects Update, then the combo box displays to select an existing record.
The subform shows related records using the Site_ID field.
thanks.