not in list will not worl

John thomas

Registered User.
Local time
Today, 10:36
Joined
Sep 4, 2012
Messages
206
Hi All
This is my first try with VBA
and it will not work Help Please
In my program i have acombo box to select products .The idear is if the product is not in the list the code should put up a message box and ask do you want to add product .If the answer is yes it should open the products orders form to allow entry
However it puts up yhe following eror code
Compile error Label not in list and highlightsthe last line of code in blue

ption Compare Datab
Option Explicit

Private Sub ProCombo_GotFocus()
ProCombo.Requery
End Sub

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

On Error GoTo Err_ProCombo_NotInList

Dim intAnswer As Integer

intAnswer = MsgBox("Would you like to add this value to the list?", vbYesNo, vbQuestion)

If intAnswer = vbYes Then

DoCmd.RunCommand acCmdUndo
DoCmd.OpenForm "frmProducts", acNormal, , , acFormAdd, acDialog
Response = acDataErrAdded

Else

Response = acDataErrContinue

End If

Exit_ProComboNotInList:

Exit Sub

Err_ProCombo_NotInList:

MsgBox Err.Description
Resume Exit_ProCombo_NotInList:

End Sub
 
Take the colon off the end.
 
Hi It still does the same .Originally i did not have the colon at the end .but thought that was my error.So put it in .I will take it off but it still puts up the same error
 
Note:

Exit_ProComboNotInList
Exit_ProCombo_NotInList
 
The name you tell the code to "Resume" to has to exist. In this case it doesn't, because of the underscore.
 

Users who are viewing this thread

Back
Top Bottom