Query Title for Printout

L

LisaB

When you print a query, it prints the name of the query as the Title. How
can you change this so that it prints a something different as the title
without changing the queries name.
--------------
1) I have a query that gets changed based on a SQL statement that the user
selects

2) The query's name is qryBulderTemp however, based on the SQL statement the
user selects I want the Title that is printed on the query to be reflective

3) I have a database table with with four fields (Name/Title, SQL Statement,
Description, UniqueKey)

4) I have a form that show the user the Title and Description, and a hidden
field for the SQL statement (txtSQL)

5) the user picks the query they want to see then clicks on a QueryView
button

This is the code behind the QueryView button

-------------------------------------------
Private Sub cmdQueryView_Click()
Dim Q As QueryDef
If IsNull(Me.txtSQL) Then
Exit Sub
Else
SQLStatement = Me.txtSQL

Set TheDB = CurrentDb()
Set Q = TheDB.QueryDefs("qryBuilderTemp")
Q.SQL = SQLStatement
Q.Close
DoCmd.ShowToolbar "Query Datasheet", A_TOOLBAR_NO
DoCmd.ShowToolbar "QueryBuilder", A_TOOLBAR_YES

DoCmd.OpenQuery "qryBuilderTemp", , acReadOnly
End If
End Sub
 
V

Van T. Dinh

Sorry, not much you can do with DatasheetView of Table or Query.
DatasheetView is meant to be used for testing only.

If you want proper print-out, you need to create a Report based on the
Query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top