Hi All --
Access newbie here, trying to write some very simple VBA code in DAO, with very little success. Newest reason to want to throw my laptop through a window is the result of run-time error 3606, which states that "query must have at least one destination field." Here's the code:
Sub Test()
Dim db As Database
Dim qdf As QueryDef
Dim rs As Recordset
Dim sqlStr As String
Dim amount As Currency
Set db = CurrentDb
sqlString = "SELECT dbo_PRT_CURRENT__CHECK.Employee " & _
"FROM dbo_PRT_CURRENT__CHECK;"
Set qdf = db.CreateQueryDef("qryTest", sqlStr)
Set rs = qdf.OpenRecordset
End Sub
As far as I can tell, my destination field is Employee, but it's not being recognized by such. By the way, the SQL string was generated by the SQL translator from the Query Design window in Access, from a Query which runs successfully. The referenced table and field exist.
Any help is appreciated.
Thanks!
Access newbie here, trying to write some very simple VBA code in DAO, with very little success. Newest reason to want to throw my laptop through a window is the result of run-time error 3606, which states that "query must have at least one destination field." Here's the code:
Sub Test()
Dim db As Database
Dim qdf As QueryDef
Dim rs As Recordset
Dim sqlStr As String
Dim amount As Currency
Set db = CurrentDb
sqlString = "SELECT dbo_PRT_CURRENT__CHECK.Employee " & _
"FROM dbo_PRT_CURRENT__CHECK;"
Set qdf = db.CreateQueryDef("qryTest", sqlStr)
Set rs = qdf.OpenRecordset
End Sub
As far as I can tell, my destination field is Employee, but it's not being recognized by such. By the way, the SQL string was generated by the SQL translator from the Query Design window in Access, from a Query which runs successfully. The referenced table and field exist.
Any help is appreciated.
Thanks!