Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

you can't go to the specified record

Status
Not open for further replies.

barbola

Technical User
Feb 27, 2003
1,132
CA
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:

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.
 
If the form Data Entry property is set to NO then add
Me.DataEntry = True, before the DoCmd.GotoRecord
 
Allow additions was set to No. I changed it and it works.

And I swear I looked and it said Yes, but when I looked again, it was No.

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top