I want to run an SQL select statement from a general module, activate on a button click event.
This is my code;
'parameter query to display stock items based on selected distributor
Public Sub DoSQL()
Dim SQL As String
SQL = "SELECT tblStock.DistributorNo FROM tblStock WHERE (((tblStock.DistributorNo)=[enter distributor no])) ORDER BY tblStock.[enter field to order by];"
DoCmd.RunSQL SQL
End Sub
but when I run it a get a needs sql object error - huh'??
I thought I had specified the object - the sql variable.....
Any suggestions??
thanks, josie
This is my code;
'parameter query to display stock items based on selected distributor
Public Sub DoSQL()
Dim SQL As String
SQL = "SELECT tblStock.DistributorNo FROM tblStock WHERE (((tblStock.DistributorNo)=[enter distributor no])) ORDER BY tblStock.[enter field to order by];"
DoCmd.RunSQL SQL
End Sub
but when I run it a get a needs sql object error - huh'??
I thought I had specified the object - the sql variable.....
Any suggestions??
thanks, josie