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

Display SQL statement into a text field on a report

Status
Not open for further replies.

vanuta

MIS
Feb 13, 2001
13
US
I have a report that is coming from a query called "PO Query". In the query there is multiple criteria:

PODte Between #1/1/99# and #12/31/99# and PoNumber Between 100 and 1200051

I want to display the where clause of the sql statement in a textbox on my report. Is there an easy way to do this????

Any help would be appreciated!

 
First, you need to create a Public string in a Module and a function to export it

[e.g.
Option Compare Database
Option Explicit
Public SQLStr As String

Function Output() As String
Output = SQLStr
End Function]

Next, in the Open event of Report, set SQLStr to the SQL clause, followed by [Me.RecordSource = SQLStr]
Now you can create the text box wherever you want on the report with the Control Source set to the function 'Output'

This use of functions like this has solved a lot of problems in forms and reports.
 
If the parameters for the query are entered into a data entry form, simply reference the variables from the form itself. htwh Steve Medvid
"IT Consultant & Web Master"
web page under development...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top