Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    U.S.
    Posts
    26

    Unanswered: help using QueryDefs

    Private Sub Command0_Click()
    Dim db As Database
    Dim qdf As QueryDef
    Dim strSQL As String
    Set db = CurrentDb

    Set qdf = db.QueryDefs("NewQRY") <------------ **** ERROR ****

    qdf.SQL = "SELECT * FROM dbo.tblRegularRates"

    DoCmd.OpenQuery "NewQRY"

    Set qdf = Nothing
    Set db = Nothing

    End Sub
    =-----------------------------------------------------------=
    This is the code im using but i keep getting an "object variavle or With block variable not set." wHATS going on??? im doing it right??

  2. #2
    Join Date
    Mar 2004
    Posts
    4

    Re: help using QueryDefs

    Originally posted by jayblaze2
    Private Sub Command0_Click()
    Dim db As Database
    Dim qdf As QueryDef
    Dim strSQL As String
    Set db = CurrentDb

    Set qdf = db.QueryDefs("NewQRY") <------------ **** ERROR ****

    qdf.SQL = "SELECT * FROM dbo.tblRegularRates"

    DoCmd.OpenQuery "NewQRY"

    Set qdf = Nothing
    Set db = Nothing

    End Sub
    =-----------------------------------------------------------=
    This is the code im using but i keep getting an "object variavle or With block variable not set." wHATS going on??? im doing it right??

    Try this:

    Set qdf = db.CreateQueryDef("NewQRY")

    on the line where you get the error

  3. #3
    Join Date
    Jan 2004
    Location
    U.S.
    Posts
    26
    still getting the same error. =(

Posting Permissions

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