Using 2 combo boxes for criteria

pholligan

Registered User.
Local time
Today, 18:21
Joined
Jan 20, 2003
Messages
19
Hi

I have a form with 2 combo boxes on to select the month and year for the criteria of a query. The date has been formatted using Format([Last day],"mmm/yy"), and the first combo box has the month in, and the second the year eg. JAN 02.

Can anyone help me with the expression I need to combine the two boxes to use as the criteria. At the moment I have :

Forms![PERIOD SELECT]![Combo0].Text & "/" «Expr» Forms![PERIOD SELECT]![Combo2].Text

But this doesn't seem to work. If I enter the criteria as JAN/02 manually then the query produces the desired result but not with this expression.

Any help would be greatly appreciated.

Paul
 
I have now worked out the problem!

The expression should have read:

[Forms]![PERIOD SELECT]![Combo0] & "/" & [Forms]![PERIOD SELECT]![Combo2]

Can anyone tell me why you sometimes need to index the Text in a combo box and other times you don't?

Thanks
Paul
 
Paul, I not too sure on this but generally I would use the .text is association with the OnChange procedure - that is, before the field update. Therefore I have generally believe that if the field hasn't been updated then .text will bring back what has been entered as opposed to updated value.

Hopefully someone will respond who DOES know.
 
Although you can refer to form controls in a query, you cannot refer to any properties. Therefore, Forms!YourForm!YourControl is a valid reference but Forms!YourForm!YourControl.Text or .Value are not.
 
.....But! In a previous query it would not work unless the text was refered to eg. [Forms]![YourForms]![FormNames].Text
 

Users who are viewing this thread

Back
Top Bottom