Error: Query needs at least one destination field

dyrueta

New member
Local time
Today, 07:06
Joined
Aug 22, 2011
Messages
6
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!
 
You set the variable sqlString but use sqlStr.
 
I feel studip now :) Thanks for the help!
 
No problem; we've all done it. Welcome to the site!
 

Users who are viewing this thread

Back
Top Bottom