Not in list warning

C

CJ

Hi Groupies

I have used Docmd Setwarnings False many times before but this time
I seem to need some assistance.

My field is a combo box.
Limit to list is Yes. (bound integer field is not visible)
My code without the SetWarnings is as follows:

Private Sub Model_NotInList(NewData As String, Response As Integer)

Dim strMsg As String

strMsg = strMsg & "Add " & NewData & " to the list?"

If MsgBox(strMsg, vbQuestion + vbYesNo, "Item Not Available") = vbNo
Then
Response = acDataErrContinue
Else
Me.Undo
Me.Dirty = False
DoCmd.OpenForm "frmModel"
DoCmd.GoToRecord , , acNewRec
Forms!frmModel!lngMakeID.Value = Forms!frmInventory.Make
Forms!frmModel!strModel.SetFocus
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
End Sub

I have tried turning off the warnings everywhere throughout
the code but to no avail.
I have no other code running off of this field.

Any ideas? What am I missing?
 
E

ErezM via AccessMonster.com

hi
if you want to use a form to add the missing (new) record to tha underlying
table, you need all other code to stop running till the form is closed (and
hpofully the record is added)
so open the form using DoCmd.OpenForm "FormName", , , , acFormAdd, acDialog
that eliminates the need to move to a new record upon opening, and halts the
calling code until that from is closed

good luck
 

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

Similar Threads


Top