Requery

  • Thread starter Thread starter Kevin Sprinkel
  • Start date Start date
K

Kevin Sprinkel

A Not In List procedure opens a data entry form when the
user enters a non-existent JobNumber in a combo box. On
returning, error 2118 is generated, "You must save the
current field before you run the Requery action."

The On Not In List code is:

Private Sub cboJobNumber_NotInList(NewData As String,
Response As Integer)
DoCmd.OpenForm "frmProjects", , , , acFormAdd, acDialog
Me!cboJobNumber.Requery
End Sub


The code returning from the data entry form is:

Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
DoCmd.Close

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click

End Sub

I thought I remembered reading recently that saving the
record was not required. Does anyone know what's wrong?

Thanks.
Kevin Sprinkel
 
try replacing the Requery command in your code with:

Response = acDataErrAdded

see the NotInList Event topic in Access Help for more info.

hth
 
-----Original Message-----
try replacing the Requery command in your code with:
Response = acDataErrAdded

see the NotInList Event topic in Access Help for more
info.

Thanks, Tina; that solved it.

Best regards.
Kevin Sprinkel
 
Back
Top