Requery

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
 
T

tina

try replacing the Requery command in your code with:

Response = acDataErrAdded

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

hth
 
K

Kevin Sprinkel

-----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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top