open query using form data

  • Thread starter member via AccessMonster.com
  • Start date
M

member via AccessMonster.com

Hi,

Help me please with this one.

I have a form "frmSearch" whith field [txtsql]. This field contain value
("Select * from [KLIENTI] Where [ID] like '*')

I would like to open query "Query1" using Command Button... where data filter
is = [txtsql]

could you please help me with this.
 
K

Ken Snell \(MVP\)

Add this expression to the WHERE: box under the field that is to be
filtered:

Forms!frmSearch!txtsql
 
J

John Spencer

The only way I can see to do that is to use VBA to build the SQL
statement on the fly. Of course, you might be able to do this
differently and set up the query1 as a parameter query using a reference
to the control in frmSearch.

Why do you want to do this? For a report, to display the data, for a
continuous form, for a subform?

More detail on what you are trying to do, instead of how you are trying
to do this may give us a better chance of providing a solution.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Top