Issue With Combo Box Query!!!

mjnov85

New member
Local time
Today, 04:50
Joined
Apr 1, 2008
Messages
6
I am designing an order form and my order form consist of a main form and a subform within it. Each order can have multiple items ordered on it. To order a certain part (unique model #) i have a query set up that inputs 1 model number when 4 other variables are chosen in a combo box by the user. Currently i have done this by writing the query statement as this (in the row source field in combo box properties):

SELECT DISTINCT QryOPNData.TDP FROM QryOPNData WHERE (((QryOPNData.Rev)=[Forms]![frmSampleOrders]![Order OPN's subform]![Revision])); This is the query statment for the TDP combo box.

I have 4 variable that must be chosen to output a model number or OPN. They are Revision, TDP, Frequency, and Coherance. The user of the form currently must enter the variable in the above order. This is where i am having a problem, if a user accidently clicks on the frequency drop down before they have chosen a Revision and TDP the combo box is blank BUT the problem is that it continues to stay blank even if the user now chooses a revision and TDP. The user has to close the form and start it up again for it to work properly.

How can i get access to run the query properly even if the user accidently clicked on a combo box out of order on the form?

I'm thinking maybe an IIF statment but i am unsure on what the parameters should be of that statment.

PLEASE HELP!!!!! :(
 
If you must select data through your Combo Boxes in a specific sequence then merely Disable (set Enabled property to False) all the Combo Boxes except the first one. Upon a confirmed selection of the first Combo Box, enable the the second Combo Box:

In the OnClick event of first Combo Box:

If IsNull(Me.myFirstCombo) = False Then Me.mySecondCombo.Enabled = True

When a confirmed selection of the second Combo Box is done then enable the third Combo Box and so forth. When you get to the last Combo Box, and again upon confirmed selection, Clear the display in each Combo Box then disable them again.

The best way to do this (I think) would be to compile your Part Number string from a Command button or some other means. This way it doesn't matter what sequence the data was entered. The string is developed from gathering the data supplied in all Combo Boxes. For example:

Dim PartStrg As String
PartStrg = Me.FirstCombo & Me.SecondCombo & Me.ThirdCombo & Me.FourthCombo


You would of course want to check the condition of each Combo Box to ensure that selected data is present.

.
 
Thank you very much. Your suggestions reallly helped and led me to cascading combo boxes. :)
 
Glad you picked up on that. ;)

Good luck with your project.

.
 

Users who are viewing this thread

Back
Top Bottom