Re: problem with form...

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks... this should work.
But I have a problem getting my code right in the DoCmd.OpenReport in the
WhereCondition

in the queries that I did, the criteria was I used
WHERE ((([intervention hydrant].[Date interv])=(SELECT MAX (tmp.[Date
interv]) FROM [intervention hydrant] as tmp WHERE tmp.[hydrant id] =
[intervention hydrant].[hydrant id])) AND (([intervention
hydrant].[Functional])=True));

for the case where I'd like to get the functional hydrant at the latest date
of intervention

how do I write this in the DoCmd.OpenReport?

Thanks again!



"Nikos Yannacopoulos" wrote:

> If i get this right, the fields are always the same, and what changes is
> the filters? If yes, you only need one report, and one query, or no
> (saved) query at all. Set the report's recordsource to your table or
> single saved query, and in the code behinf the command button on the
> form which opens the report, construct a Where statement, based on the
> user's selections on the form; then use this string in the
> WhereCondition argument in the DoCmd.OpenReport.
>
> On your other question, Also, put this code in the report's On No Data
> event:
>
> msg = "No data exists for the chosen criteria."
> typ = vbExclamation
> ttl = "Report cannot be generated"
> MsgBox msg, typ, ttl
> Cancel = True
>
> This will produce a message for the user and cancel opening the report,
> if there is no data.
>
> HTH,
> Nikos
>
.


Quantcast