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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not In List Event?

Status
Not open for further replies.

tfayer

Technical User
Aug 4, 2002
41
US
I have a combo box [cmbCompany] whose:
Record Source = tblCompnay
Row Source
Column 1 = [companyID](Autonumber)
Column 2 = [company]
I have column widths set to 0;1.5 so only the [company] name shows.

Bound Column = 1

I have Limit to list set to Yes.
In the Not in List Event I have code to bring up a Yes/NO msg box that says Company not in list would you like to add a new company. If User says yes the [frmCompany] in Data Entry Mode pops up?

The problem occurs after my msg box pops up the standard msg box saying the item you entered is not in the list please select or enter an item that matches...and this blicks my frmCompany Data Entry form from opening. Is there any way to get around this?

Thanks.
 
After Inserting your new company info, requery the combo box. That may work. Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need!
 
In the NotInList event code you must set the variable Response to one of the following values:-
acDataErrDisplay
acDataErrContinue
acDataErrAdded

It is the last one that you need.



'ope-that-'elps.


G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Your NotInList event includes a Response parameter. Set response to one of the following enumerated constants to stop the system errors. Syntax - Response = acDateErrAdded, etc. Also, if you pop up your company form so the user can add the new company, you can pass the NewData to it with OpenArgs. Don't forget to call your company form as a Dialog form so the underlying code waits until the new company has been entered.

If you already know all of the above, my apologies for bringing it up. The first couple times I did things like that, I forgot one or the other of the steps and it caused me some problems until I figured it out.

acDataErrAdded - I took care of it myself by adding record
acDataErrContinue - I handled it myself
acDataErrDisplay - Show system error message

Good Luck! Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need![thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top