Hi,
I am sure this is a simple error but I just can't get it.
I want to open a form with information based on today's date. I then want to have the ability to click buttons to advance or retard the date and then show the appropriate data for the new selected date.
I thought the best way would be to use a SQL Select in the form's On Open event VBA code and then increase or decrease the date in the SQL by clicking the buttons but I just can't get even the basic SQL to work.
The Datebase I am working on is (reasonably) complicated so I have created a very simple Datebase with just 1 table and one form to test the SQL. It still doesn't work ! Where am I going wrong please...
Option Compare Database
Private Sub Command20_Click()
Dim testsql As String
testsql = "SELECT * FROM Products WHERE ProductID = 14;"
DoCmd.RunSQL testsql
End Sub
Each time I click on the test button I get the error - "A RunSQL action requires an argument consisting of an SQL statement"
The Table and Form are both called "Products"
Thanks
Oscar
I am sure this is a simple error but I just can't get it.
I want to open a form with information based on today's date. I then want to have the ability to click buttons to advance or retard the date and then show the appropriate data for the new selected date.
I thought the best way would be to use a SQL Select in the form's On Open event VBA code and then increase or decrease the date in the SQL by clicking the buttons but I just can't get even the basic SQL to work.
The Datebase I am working on is (reasonably) complicated so I have created a very simple Datebase with just 1 table and one form to test the SQL. It still doesn't work ! Where am I going wrong please...
Option Compare Database
Private Sub Command20_Click()
Dim testsql As String
testsql = "SELECT * FROM Products WHERE ProductID = 14;"
DoCmd.RunSQL testsql
End Sub
Each time I click on the test button I get the error - "A RunSQL action requires an argument consisting of an SQL statement"
The Table and Form are both called "Products"
Thanks
Oscar