Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    7

    Unanswered: Recordset based on a SQL query ???

    Here is my problem.
    Id like to find out dynamicaly the key of an object in the table OBJECTSTable, knowing its NAME and PARTICULARITY.

    I thought to use a SQL QueryDef like that :


    ************************************************** ********
    Set qdf = CurrentDb.CreateQueryDef("")
    qdf.SQL = "SELECT [OBJECTSTable].Key FROM [OBJECTSTable] WHERE (([OBJECTSTable].[Name]=" & MyName & " AND " _
    & " [OBJECTSTable].[Particularity]=" & MyParticularity & "))"
    ************************************************** ********

    This works perfectly well.
    But when I want to put the query in a recordset to extract the first value, like that ..


    ************************************************** *********
    Set rst = qdf.OpenRecordset()
    ConfReference = rstinter.Fields(0)
    ************************************************** *********

    Im said, at the first line, that there is too few parameters, 2 are expected.

    BUT ALL THE EXEMPLES I SAW USE THAT SENTENCE WITHOUT (Set rst = qdf.OpenRecordset()) PROBLEM. SO I CANT UNDERSTAND WHAT IS THE MATTER.

    Can someone help me ?

  2. #2
    Join Date
    Jan 2003
    Location
    Aberdeen, Scotland, UK
    Posts
    168
    I put the answer on the previous thread but:

    set rst=db.openrecordser(qdf)
    J.

Posting Permissions

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