The correct syntax for a WHERE clause when opening a report using
OpenReport
macro action:
[NameOfField] = Forms![NameOfForm]![NameOfControl]
You do not use the table name in the WHERE clause. Assuming that
Department
is the name of a field in your report's RecordSource query,
[Department]=[Forms]![Print Advance Dialog]![Select Dept]
You say the error you get is a syntax error? Are you trying to combine
the
two criteria clauses from the [To Date] / [From Date], and [Select Dept]
controls? If yes:
[Department]=[Forms]![Print Advance Dialog]![Select Dept] And
[DateOfNextCal] Between [Forms]![Print Advance
Dialog]![From Date] And [Forms]![Print Advance Dialog]![To Date]
--
Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
Hi Ken thank you for replying, I have since fixed the problem by put
the
following into the macro Where Condition:
[Forms]![GageInfo]![Gauge ID]=[GaugeInfo Query]![Gauge ID].
But I do have another problem which is:
I have a Multiple Selection print dialog form
Which I am operating with macros (because I am a novice with VBA!!).
But
when I select a Dept from a List box and enter the dates into the "From
Date"
and "To Date" I dont know how or to add the macro to look for the
dates? I
have another selection there that does what i want it to do look for
the
dates and it works???
In the macro that does work and is asking for All depts and set dates
the
Where Condition is:
[OverDueNextYear]![DateOfNextCal] Between [Forms]![Print Advance
Dialog]![From Date] And [Forms]![Print Advance Dialog]![To Date]
And the one that does not work:
[OverDueNextYear]![Department]=[Forms]![Print Advance Dialog]![Select
Dept]
I tried add the above to this one but it kept saying syntax error??
Can you help??
:
Please provide much more detail about the structure of the report and
form.
How are they related? What do you mean by "do not correspond with each
other"? Do you want to print the report while you're viewing the form?
--
Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
Hi I want to print a report that has just been updated by the form
but
they
do not corresponed with each other does any one knoww how to get
them
to
connect . My relationships match ect but. Should I put something in
the
Filter box? please help if you can
Jo