Results 1 to 3 of 3
  1. #1
    AUJoe's Avatar
    AUJoe is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    2

    Problems with "OpenQueryDef"


    I'm converting several older databases from Access 97 to 2003 and then to 2007. The database I'm working on now has several lines of code referencing "QueryDef" which is causing compile errors. Particularly the "OpenQueryDef" line which I belive to be obsolete. Does anyone have any suggestions?

    Dim qudef As QueryDef

    Set qudef = dbABC.OpenQueryDef("Pur-PO-Log-Query", SQLPOLogForm())

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    How are you using it (you didn't give much to go on):

    Code:
    Dim qudef As QueryDef
    
    Set qudef = Currentdb.QueryDefs("Pur-PO-Log-Query")

  3. #3
    AUJoe's Avatar
    AUJoe is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    2
    I believe it is being referenced on a form via a radio button. Here is the full section of code.

    Private Sub cboUserID_Click()
    Dim dbABC As Database
    Dim qudef As QueryDef
    iActivity = True
    Set dbABC = DBEngine.Workspaces(0).Databases(0)
    sUserID = cboUserID.Column(0)
    sUserName = cboUserID.Column(1)
    txtUserName.Value = sUserName
    iNoUserID = False
    DelQuery dbABC, "Pur-PO-Log-Query"
    Set qudef = dbABC.OpenQueryDef("Pur-PO-Log-Query", SQLPOLogForm())
    qudef.Close
    CloseDB dbABC
    End Sub

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

Similar Threads

  1. ComboBox "Select" and "DLookUp"
    By witooldas in forum Forms
    Replies: 0
    Last Post: 03-23-2011, 03:31 AM
  2. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 PM
  3. Replies: 5
    Last Post: 07-19-2009, 08:37 AM
  4. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 AM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 PM

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