turn off microsoft error

A

alex

I've added some VBA coding to the 'On Not In List' event to an unbound
combo box. This coding includes a msgbox instructing the user what to
do. It works slick but after the user make his/her choice Access'
'not in list' error appears causing the user to respond once again.

Is it possible to override this error?
I'm sure there's a way around this...such as > limit to list = NO, and
then coding the combo box to check for records. Thoughts?

alex
 
D

Douglas J. Steele

What's the exact code you've got in the NotOnList event? Are you remembering
to set the value of Response appropriately?
 
A

alex

What's the exact code you've got in the NotOnList event? Are you remembering
to set the value of Response appropriately?

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)








- Show quoted text -

Here's the code Doug:

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

Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte

strMessage = "EMPLOYEE_NUMBER NOT IN DATABASE! WOULD YOU LIKE TO
ADD IT?"
intOptions = vbQuestion + vbYesNo
bytChoice = MsgBox(strMessage, intOptions)

If bytChoice = vbYes Then
Combo42.Value = ""
MsgBox "Please choose 'ADD RECORD' below"
DoCmd.GoToControl ("cmdADD")

Else
Combo42.Value = ""
End If
 
A

alex

What's the exact code you've got in the NotOnList event? Are you remembering
to set the value of Response appropriately?

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)








- Show quoted text -

I hope I wasn't confusing Doug...I'd like to override the error
message since i'm already providing one.
 
D

Douglas J. Steele

alex said:
On Jun 27, 2:07 pm, "Douglas J. Steele"

Here's the code Doug:

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

Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte

strMessage = "EMPLOYEE_NUMBER NOT IN DATABASE! WOULD YOU LIKE TO
ADD IT?"
intOptions = vbQuestion + vbYesNo
bytChoice = MsgBox(strMessage, intOptions)

If bytChoice = vbYes Then
Combo42.Value = ""
MsgBox "Please choose 'ADD RECORD' below"
DoCmd.GoToControl ("cmdADD")

Else
Combo42.Value = ""
End If

As I said earlier, you need to set the value of Response in your code.

Check the Help file. Valid values for Response are acDataErrDisplay (1),
acDataErrContinue (0) or acDataErrAdded (2). It sounds as though you need to
use acDataErrContinue.
 
A

Arvin Meyer [MVP]

Here's the code Doug:

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

Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte

strMessage = "EMPLOYEE_NUMBER NOT IN DATABASE! WOULD YOU LIKE TO
ADD IT?"
intOptions = vbQuestion + vbYesNo
bytChoice = MsgBox(strMessage, intOptions)

If bytChoice = vbYes Then
Combo42.Value = ""
MsgBox "Please choose 'ADD RECORD' below"
DoCmd.GoToControl ("cmdADD")

' Try adding the following line here
Response = acDataErrContinue
 
A

alex

' Try adding the following line here
Response = acDataErrContinue






- Show quoted text -- Hide quoted text -

- Show quoted text -

Thank you Arvin and Doug; it worked.
Doug, I apologize--I didn't know what you meant!

alex
 
Top