disable default message (NotInList)

  • Thread starter FlyingDragon via AccessMonster.com
  • Start date
F

FlyingDragon via AccessMonster.com

hi all
i get the following code to add items in my combobox
it works fine
my problem is the default access message still appear if i click NO
Any help plz?


Private Sub DesID_NotInList(NewData As String, Response As Integer)
Dim strMsg As String
Dim rst As DAO.Recordset
Dim db As DAO.Database

strMsg = "'" & NewData & "' is not in the list. "
strMsg = strMsg & "Would you like to add it?"

If vbNo = MsgBox(strMsg, vbYesNo + vbQuestion, "desid") Then

Response = acDataErrDisplay

Else

Set db = CurrentDb()
Set rst = db.OpenRecordset("CrimesDes")

rst.AddNew
rst("CrimeDes") = NewData
rst.Update
Response = acDataErrAdded
rst.Close

End If
 
B

Benjamins via AccessMonster.com

Hi,

Try acDataErrContinue instead of acDataErrDisplay
acDataErrContinue: Doesn't display the default message to the user
acDataErrDisplay: Displays the default message to the user.
 
D

Douglas J. Steele

You may also want to put

Me.DesID.Undo

in the No branch of the If statement.
 
F

FlyingDragon via AccessMonster.com

Benjamins said:
Hi,

Try acDataErrContinue instead of acDataErrDisplay
acDataErrContinue: Doesn't display the default message to the user
acDataErrDisplay: Displays the default message to the user.
hi all
i get the following code to add items in my combobox
[quoted text clipped - 26 lines]
works great many thanks
 

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