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

Query Criterion and combo boxes

Status
Not open for further replies.

gw73

MIS
Dec 30, 2001
16
0
0
US
I have two parameter set in the criterion box and it works just find. The criterion is Like "CP-" & [Select the Cup Repitition:] & "*" And Like "CP-????.???." & [Enter the Cup Sample Depth:] When I changed it so I could use combo boxes instead of paramater boxes to Like "CP-" & [forms]![frmRep]![cboRep] & "*"And Like "CP-????.???." & [forms]![frmSmpDep]![cboSmpDep] It completely skips over the first like and only uses the second. I've taken out the second like statement and it still ignors the first. Any suggestions would be greatly appreciated.

Gw73
 
Use your code behind the form to output a message box with the contents of the combo box immediately before your query

MsgBox("CP-" & [forms]![frmRep]![cboRep] & "*")

I expect it is just returning "CP-*" and therefore selecting all records, have a look and see if this is the problem. If not come back with the full query and we'll take a look
 
Thanks for taking the time to answer. I am still very new at access and VB in general. I have done similar things with a single form, select a value in the combo box and then place a button on the form to preview a report based on a query with the value in the combo box. This time I need two values passed to the query. I perfer the combo box to the paramater box because I can limit the imput to certain values. I need two values because the numbering system of the cups (not my system). The numbering sytem is as follows. CP just stands for cup. The first digit of the first group of four digits represents the repetition number, so I need to sort by this number. The second group of three I don't need to sort off of. The third group is a depth number, either one or two. I need to sort off the first and third groups.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top