Displaying SQL generating results

G

Guest

Hi,

I have a criteria form (frmCriteria) in which users select which fields
within the table they'd like to search. The code generates a SQL that is the
recordsource for the results form (frmResult). The SQL itself is built by
concatening a basic SQL (SELECT {fields} FROM {tables} INNER JOIN . . .) and
a filtered SQL (depending on which fields & data the user has selected) -
specifically:

strCriteriaSQL = strBasicSQL & " WHERE " & strFilter & _
" ORDER BY tblReceipts.ReceiptKey;"

Then I have DoCmd.OpenForm "frmResults". This all works fine, I get just
the results I expect. However, the users would like the Results form to
include a display of the filters. RecordSource just displays the name of the
query - what I'd like to do is have a textbox that displays the strFilter
portion of the SQL. Can anyone offer a suggestion for the best method to
accomplish this? Thanks in advance.
 
G

Guest

You can send the contents of strCriteriaSQL to a text box in your form by
adding this after you open the form:

[forms]![frmResults]![MyTextBox] = strCriteriaSQL
forms("frmResults").refresh

<a ref="www.joshdev.com">jl5000</a>
 
G

Guest

That did the trick! Thanks again.

jl5000 said:
You can send the contents of strCriteriaSQL to a text box in your form by
adding this after you open the form:

[forms]![frmResults]![MyTextBox] = strCriteriaSQL
forms("frmResults").refresh

<a ref="www.joshdev.com">jl5000</a>

Jenny Barker said:
Hi,

I have a criteria form (frmCriteria) in which users select which fields
within the table they'd like to search. The code generates a SQL that is the
recordsource for the results form (frmResult). The SQL itself is built by
concatening a basic SQL (SELECT {fields} FROM {tables} INNER JOIN . . .) and
a filtered SQL (depending on which fields & data the user has selected) -
specifically:

strCriteriaSQL = strBasicSQL & " WHERE " & strFilter & _
" ORDER BY tblReceipts.ReceiptKey;"

Then I have DoCmd.OpenForm "frmResults". This all works fine, I get just
the results I expect. However, the users would like the Results form to
include a display of the filters. RecordSource just displays the name of the
query - what I'd like to do is have a textbox that displays the strFilter
portion of the SQL. Can anyone offer a suggestion for the best method to
accomplish this? Thanks in advance.
 

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