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

Prevent a combobox updating when criteria is met

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
586
GB
Hello I have a form with a combobox called CboOffer

Also on the form I have a textbox with a Dcount function - the textbox is called txt_Offer_Count

If [txt_Offer_Count] has a value of 0 I would like [CboOffer] to update when the user selects any value.

If [txt_Offer_Count] has a value of >0 I would like [CboOffer] to update when the user selects a value other than Offer.

If we leave the Offer criteria to one side, I thought I would just test the before update event as follows:

Using the before update event of the combobox:

Code:
if me.txt_offer_Count > 0 then
   me.CboOffer.undo
   msgbox "There is already an offer"
 end if

The message displays OK, but the combobox is updated with the new value (which I don not want).

Any ideas - thanks Mark
 
I hate these solutions where you present the user a choice that they cannot select then tell them they cannot select it. Instead after an offer is selected ([txt_Offer_Count] has a value of >0) requery the combo to remove offer as a choice. Select choices from sometable where not somevalue = "Offer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top