QueryDefs in Macro?

  • Thread starter Thread starter Paul S Panoff
  • Start date Start date
P

Paul S Panoff

I haven't used QueryDefs before ams am having problems.
I am getting a run time error of object type mismatch when using the
following code in a macro.
The "Map Extract" query is an existing query in the database that runs
fine outside of the macro.

Public Sub UpdatePersonValues()
' use to update the map-Prsn field with unique sequential values that
' represent the color codes for the routes within each cycle

Dim rsQ As Recordset
Dim svOfc As String, svCyc As Integer, svRte As String
Dim colorCnt As Integer

Set rsQ = CurrentDb.QueryDefs("Map Extract").OpenRecordset() <---run
time error here!

'begin loop to go thru all records from query

With rsQ
 
Paul,

Should be...
Set rsQ = CurrentDb.OpenRecordset("Map Extract")

By the way, this is not a macro.

- Steve Schapel, Microsoft Access MVP
 
Thanks for the suggestion, but the results are the same. I still get the
type mis-match runtime error.
 
Paul,

Please post the SQL view of the Map Extract query.

- Steve Schapel, Microsoft Access MVP
 
Back
Top