I would like the Query to get it's where statement from a Form

  • Thread starter Thread starter Mik
  • Start date Start date
M

Mik

I'm trying to figure out a way that my query will be able
to get it's where conditions from a Form.

The query in SQL :
SELECT Table1.*, FROM Table3
WHERE [FORMS]![FORM1]![SQLWHERE];

The WHERE statement that is on the form
((Mid([Table1].[PN],6,5))=54000) AND ((Mid([Table1].
[PN],12,6))=970600 Or (Mid([Table1].[PN],12,6))=970600)
 
Mik,

You are going to have to do this in code, maybe in the
click event of a command button.

Something like:

Private Sub cmd_Requery_Click()

Dim strSQL as string
strSQL = "SELECT Table1.* " _
& "FROM Table1 " _
& "WHERE " & [FORMS]![FORM1]![SQLWHERE];
me.Recordsouce = strSQL
me.requery

end sub

HTH
Dale
 
Back
Top