Results 1 to 3 of 3
  1. #1
    tnt is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    2

    DAO error in Set rst line...

    I have these lines in a procedure...


    Dim TempDB As DAO.Database
    Dim CustRecs As DAO.Recordset
    Dim MySQL As String
    MySQL = "SELECT * FROM CustCopy WHERE [CustEmail] Is Not Null"
    Set CustRecs = TempDB.OpenRecordset(MySQL, dbOpenDynaset)

    Last line giving me problem: Error #91 - Object variable or With block variable not set

    I've tried modifying the last line to read...
    Set CustRecs = TempDB.OpenRecordset(MySQL, dbOpenSnapshot)
    ... but I still get the same error. Ideas anyone? Am I looking at possible corruption. Am I overlooking the obvious?

  2. #2
    Bob McClellan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Location
    New Jersey
    Posts
    17
    I use ADO with Projects having SQL backends but if I remember
    correctly, you should be able to do something like this...

    dim rs as recordset
    rs = "SELECT * FROM CustCopy WHERE IsNull([CustEmail]) = false"
    NOTE: to query in an .MDB use IsNull
    CurrentDb.OpenRecordSet(rs)
    ... I think that should work....
    hth,
    ..bob

  3. #3
    SteveH2508 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2010
    Location
    Chelsea, London, England
    Posts
    117
    You need to instantiate the variable TempDB with Set TempDB = CurrentDb

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 04-11-2011, 03:58 PM
  2. How to do line by line compare of VB code?
    By Buakaw in forum Access
    Replies: 2
    Last Post: 02-14-2011, 11:46 PM
  3. Replies: 8
    Last Post: 01-19-2011, 04:48 AM
  4. Replies: 5
    Last Post: 12-06-2010, 10:15 AM
  5. Wrap line
    By devcon in forum Reports
    Replies: 1
    Last Post: 10-22-2010, 09:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums