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

How to set Criterial of Query by Form

Status
Not open for further replies.

lgjames

MIS
Jul 1, 2005
3
US
Hi, I want to set Criterial of Query by form, for example, I have a Form with combo box which I can select the salesperson, then I want to review the report only by this salesperson, so I want to set the criterial of "salesperson"= " " for the Query.
And also I want to view chart report by this way also!

I do not know VBA, can I use Macro to do it?

thanks in advance!

James
 
You don't need either VBA or a macro... In your query design view, in the criteria for the "salesperson" field, put
[Forms]![[blue]frmMyFormName[/blue]]![[blue]cboMyComboName[/blue]]

Replace the names in blue with the appropriate names from YOUR form. Then as long as the form is open and a value is selected in the combo when you run the query, it will return the records you want.

Ken S.
 
Eupher, thanks for the reply
I set the criteria for the query, but there is a problem when I open the report.
the report is a chart report base on the query,
in the query I set criteria for "Date"= Between [Forms]![FrmReport]![BeginDate] And [Forms]![FrmReport]![EndDate], "salesperson"=[Forms]![FrmReport]![sales]...

I can open query and see the data after I input value to the form, but when i open the chart report, it shows like this: "The Microsoft Jet database engine does not recognize '[Forms]![FrmReport]![BeginDate]' as a valid field name or expression."

how should I fix it!

thanks again
 
lgjames,

I have never used charts in my reports, so I'm totally out my depth on this one. However, I suspect as a workaround you could change your query to a Make Table query, then use the resultant table as the source for your chart/report. You might get a better answer to this one if you post in the Reports forum.

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top