G
Guest
Hi,
I relatively new to Access. I want to have a query excecuted by some SQL
code. Below is the codse I have written:
Option Compare Database
Private Sub Keycode_Change()
Dim sSql As String
sSql = "SELECT Table1.Dept, Table1.Keycode, Table1.Value FROM Table1
WHERE (((Table1.Dept)=2));"
DoCmd.RunSQL sSql
End Sub
Table 1 consists of:
Dept Keycode Value
1 123 1
1 321 1
1 444 55
1 555 99
2 341 2
2 454 3
When I run it I get the following error:
'A RunSQL action requires an argument consisting of an SQL statement'
I relatively new to Access. I want to have a query excecuted by some SQL
code. Below is the codse I have written:
Option Compare Database
Private Sub Keycode_Change()
Dim sSql As String
sSql = "SELECT Table1.Dept, Table1.Keycode, Table1.Value FROM Table1
WHERE (((Table1.Dept)=2));"
DoCmd.RunSQL sSql
End Sub
Table 1 consists of:
Dept Keycode Value
1 123 1
1 321 1
1 444 55
1 555 99
2 341 2
2 454 3
When I run it I get the following error:
'A RunSQL action requires an argument consisting of an SQL statement'