SQL Query Help Please! (1 Viewer)

B

BigAppa

Guest
Is it possible to add a text box field in your form so that a user using a form interface I created for the database can type standard SQL queries (SELECT statements etc.) and get back a report with the results? I have a standard reports created and a form for a user friendly interface. But for additional flexibility for power users, I'd like to add a field in which SQL queries can be inputed and will return one of my standard reports with just the queried info. (I'm thinking there may be away to manipulate the SQL in the SQL view for queries, then run that query?)

Whoever can help me with this is the BOMB!
 

charityg

Registered User.
Local time
Today, 16:05
Joined
Apr 17, 2001
Messages
634
I say absolutely this can be done. I'm speaking theoretically of couse, but you can set the datasource for the report on the fly.

So if your interface contains a textbox, and the user click the command button to print the report, the on_click event of the command button would be something like:


dim strSQL as string
dim strDoc as string
dim rpt as report


If txtSQL <> "" then
strSQL=me!txtSQL
else
strSQL="enter datasource for standard report"
endif

strDoc="rptName"
rpt=Reports!rptName

rpt.datasource=strSQL

docmd.openreport strDoc

Now keep in mind that I haven't tested this, and it's only theory, and there are alot of holes and error that need trapping, but it's a start.

Let me know what you think,
Charity
 

Users who are viewing this thread

Top Bottom