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!

Trouble querying more than 2 fields using a form for criteria

Status
Not open for further replies.

bjc1007

Programmer
Jul 3, 2002
5
US
I have a report that's using a query for its source and I have two fields in the query that get their criteria from a form (in the criteria section I have forms!myForm!myControl). I need to have two more fields get their criteria from this form, but when I try to do this the query comes up blank. Is there a reason why I can't have more than 2 fields get their criteria from the form? If I enter simple expressions for these fields (eg Like "*") it works fine, it's just when I try to sort the date through the form. Any ideas??
 
obviously that extra field that you are trying to incorporte is a conflict with one of the other fields data in your query. I am not sure what it is beacuse I can't see your query. mabey if you elaborate a little more. "The greatest risk, is not taking one."
 
To elaborate a little bit, let's say I have four fields in form frmSelectObjects:

objectID
Location
Table A
Table B

In the form I have combo boxes for the 4 fields (with a value list as the rowsourcetype), and then from the form you can open a report that displays the selected data. So you select an object, a location, and tables A and B, then open the form which has a query attached with forms!frmSelectObjects!myControl as criteria for the same 4 fields in the query. So in the objectID field I have forms!frmSelectObjects!objectID as the criteria. This works fine, except I've realized the problem comes when selecting tables. In the form, the lists for combo boxes Table A and Table B both have an asterisk as the first choice, for selecting all (or any) tables. The query comes up blank when the * is selected for either table. In the table all of this is based on I've made sure that fields Table A and Table B have no null values, and if I simply type in Like "*" as the criteria instead of forms!frmSelectObjects!TableX, it works fine. Does that help?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top