use a query in a caption

  • Thread starter Thread starter Roman
  • Start date Start date
R

Roman

Is it possible to use a query in a caption? I have a
report and I want one of the captions to display the
contents of a query.

Thanks for your help.

Roman
 
Is it possible to use a query in a caption? I have a
report and I want one of the captions to display the
contents of a query.

Thanks for your help.

Roman

You could open the QueryDef in code and change the Caption property
before the query opens. Never done it, but it should be possible.

Are you sure you don't just need a crosstab query or a pivottable?
 
You may want to clarify a bit more what you meants
by "contents" of a Query.

Do you meant the SQL String of the Query? or the dataset
returned by the (Select) Query?

Note that Select Query doesn't return a value! Even if in
the DatasheetView of the Query only shows 1 row by 1
column, it is still a set of record(s), not a single value.

Also, I think you mean the Label Control in the Report.
Caption means something else.

HTH
Van T. Dinh
MVP (Access)
 
you might be able to use the DLOOKUP() function to return a value that
can be displayed as a label or caption.

I think you would have to put this in the reports Open Event

Private Sub Report_Open(Cancel As Integer)

Me.Caption = NZ(DLOOKUP("FieldName", "yourquery"), "Not Found")

End Sub

--
HTH

Dale Fye


Is it possible to use a query in a caption? I have a
report and I want one of the captions to display the
contents of a query.

Thanks for your help.

Roman
 
Surely if you have the OwnerID then you can print the Owner Name in the
Group Header.

If you base the Report on the Table Equipment then change the RecordSource
of the Report to a Query combining the Table Owner and Table Equipment and
include the Owner Name in the Fields to be returned. After that, you can
included the Owner Name in the Group Header.

The "Legend" box is the wrong approach. If you have a 100-page Report, you
don't want the users to go back and forth for the Owner Name.

Have you read any Access book? This is basic stuff and any Access book will
cover using Query as the RecordSource. In fact, the Report Wizard should be
able to do this.
 
Thank you very much, that clears up a lot. Is there a
particular Access book that you recommend?

Roman
 
I started with Roger Jennings' Access 2 Developer's Guide (SAMS) and Roger
Jennings' Using Access 97 Special Edition (QUE).

However, each person tends to have a different learning style and the best
way is to go to a well-stocked bookshop and browse around to see which book
suitable for you. Don't worry about whether it has enough depth or coverage
as you will buy more if you are serious about using & programming Access
databases.
 
Back
Top