Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Location
    Indianapolis, Indiana, USA
    Posts
    80
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Tempory QueryDef (97 (SR2))

    I get the error message "Access Can't Find the object #'Temporary Query Def#'" when executing the following code:


    Private Sub SelectLabs_Click()
    On Error GoTo Err_SelectLabs_Click
    Dim strDKstart, strDKend, strSelect As Variant
    Dim qdf As QueryDef
    Dim dbs As Database

    Set dbs = CurrentDb
    strSelect = "SELECT SampleLab.SampleID, SampleLab.Laboratory FROM SampleLab;"
    MsgBox strSelect
    Set qdf = dbs.CreateQueryDef("", strSelect)
    DoCmd.OpenQuery qdf.Name

    Exit_SelectLabs_Click:
    Exit Sub

    Err_SelectLabs_Click:
    MsgBox Err.Description
    Resume Exit_SelectLabs_Click

    End Sub

    As soon as I figure out how this works and what I am missing here, I am going to expand this into a multiselect form.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Tempory QueryDef (97 (SR2))

    DoCmd.OpenQuery only works with stored queries, not with temporary querydefs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •