VBA and SQL Error Message

dbmanalser84

Registered User.
Local time
Today, 18:36
Joined
Feb 26, 2008
Messages
52
I've started learning VBA recently and came to the part of working with SQL in VBA. Up until now, all the things I did as the tutorial said worked prerfectly, except this one.

I've wrote this piece of VBA code:
Code:
Private Sub intPrevoznikID_AfterUpdate()
    Dim SQL As String
    SQL = "SELECT txtVremePolaska FROM tblKarta"
    DoCmd.RunSQL SQL
End Sub

...and it is tied to a forms control AfterUpdate Event. When I execute the code I'm getting this error message:

Run-time error '2324'
A RunSQL action requires an argument consisting of a SQL statement.

What am I typing wrong here? this is an example from Access Help (F1 key).

Thnx.
 

Users who are viewing this thread

Back
Top Bottom