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

Form feeding criteria to Query

Status
Not open for further replies.

Prufrock

Instructor
Joined
Sep 4, 2002
Messages
77
Location
AU
I hve used this approach often and have had it work very effectively. I have a query which has the following in one of its field criteria [Forms]![frmProjectName]![cboProject].
I have a form with a combo box that accesses a table and offers a range of choices to feed criteria into that query.
For example people want to see all the Projects starting with "P" in a report. So the report is based on the query. I have command buttons on the CBO form that preview the report once the OK button is clicked.
The query works fine if I type - Like "P*" - into the criteria. I have "P*" and other letters in the table that feeds the combo box.
I can't get the report to return any data when I click Ok on the frmProjectName.
I have tried feeding =Like "P*", Like "P*", etc but to no avail. Any ideas.
 
If the *'s are part of the table data, you could remove them and use Like [Forms]![frmProjectName]![cboProject] & "*" for the criteria.

Let them hate - so long as they fear... Lucius Accius
 
Looked good and tried it but because I have the letters in the table e.g. P then the syntax you provide with & "*" just means everything appears in the report. Any thoughts. Thanks.
 
hmmm... What it should do is take the letter selected using the combobox and substitute it for the [Forms]![frmProjectName]![cboProject] part.
The & "*" completes the criteria, resulting in Like "P*" which filters for all matching records; in the case of "P" being selected, those which start with P.

Let them hate - so long as they fear... Lucius Accius
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top