Displaying SQL generating results

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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>
 
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.
 
Back
Top