Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Question

Status
Not open for further replies.

RandyMyers

IS-IT--Management
Apr 28, 2004
85
US
Does anyone know how to turn off the message about an item not being on the list in a combo box. The SetWarnings = No macro function does not work on this message.

What I am trying to do it this:

I have a ComboBox and I have Limit To List turned on so that the Event OnNotInList works. What I am doing is if the entered Vendor is not in the list I open an entry form for the new Vendor to be added. This all works correct except I still get the message

"The text you entered isn't an item in the list.
Select an item from the list, or enter text that matches one of the listed items."

The end user can simply click ok and enter a new record, no problem, however I would prefer to not have this message appear at all (I have my own message box come up informing them that they will need to add a Vendor to the list and then I open the entry form on a new record for them to add the Vendor).

SetWarnings = No does not prevent this particular message.

Anyone have any ideas of how to surpress this warning?

Thank you as always!
 
check your properties and any VBA code related to the listbox.
in the VBA there should be a statement
MsgBox Err.Description

Just make this into a rem statement ie 'MsgBox Err.Description or delete it and the error messages for that listbox will stop.

Program Error
Programmers do it one finger at a time!
 
Hello,

Thank you for responding, however I can not figure out how to make your method work. This particular instance I am using a standard combo box and the OnNotInList event to run a macro. There is no code behind the scene that is generating this message, but instead it is being generated by the system because Limit To List setting has to be turned on for the OnNotInList even to work. The message can not be over ridden by turning SetWarnings = No macro event which would normally work. It is not a message that stops the macro, but instead a system information message that lets you know that your entry is not in the list (it seems silly that this message would be given when you are using the OnNotInList event). I simply want to turn this built in message off.

Is there some code I can put on the event to do this?

 
In the NotInList event procedure play with the Response parameter:
Response = acDataErrAdded

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PH,

Thanks for your response. Is there any way you might be able to elaborate a little. I do not see a response parameter?

Thank you for your help.


Randy
 
PHV said:
In the NotInList event [highlight]procedure[/highlight]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I understand procedure, as in what happens on this event, however I do not understand what you mean with the response parameter....

Could you possible give me an example of what you are referring to?

the In the NotInList event procedure does not help...
 
When entering the not in list event procedure, the sub header should say the following:

[tt]private sub comboname_notinlist(newdata as string, response as integer)[/tt]

The latter, is the response parameter, which can be set to what you wish with regards to message box.

[tt]response=acdataerrcontinue[/tt]

should turn off the message box.

Roy-Vidar
 
Thank You Roy,

Now I understand and that worked fine...

I just put your line in and then DoCmd.RunMacro("mcrNameOfMacro")
which runs the macro that opens the message box, opens form, creates new record, etc etc....

Randy
 
Most of us try to encourage VBA vs Macros, for lots of reasons, here's a quote from Access Developers Handbook, Sybex
"
* can't recover from errors
* can't easily be used for looping
* are difficult to debug
* can't be used to step through recordsets
* can't be used in transaction processing
* can't pass parameters
* can't be used to call DLLs
* can be halted by users with Ctrl+Break (and this can never be turned off)

The bottom line is that you should program using VBA code for all your application development, except when you only need to create a quick-and-dirty prototype or you wish to create a simple application that only you will use."

Roy-Vidar
 
Hey Roy,

Appreciate your input.

I use a combination of macros and VBA. I find it easier to duplicate and modify macros, easier to keep track of the logical flow, easier when the same procedure is needed in many forms, such as Maximize screen...

For any of the situations you mentioned I would use VBA.

Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top