Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    3

    Unanswered: Executing a parameter query in VBA

    I have a combo box on my form that is based off a parameter query.

    In order to add a record to the form, I have to check if there are records or not in the combo box (so I know if i should use the
    DoCmd.GoToRecord , , acNewRec
    command.

    So, the parameter query the combo box is based off is called(FunderCheck), and i am trying to open it with a recordset in vba, but when i try to run this, my error is: "Too few parameters. Expected 2". The form is open and the parameters are there, so i don't know quite what else to do. Here is the code (this is Access XP):

    Dim rst as Recordset
    Dim db As Database

    Set db = CurrentDb

    Set rst = db.OpenRecordset("FunderCheck",
    dbOpenDynaset)

    As an alternative, I'm thinking i may be able to have another query that counts how many (if any) records are counted in the FunderCheck query, i just don't know how to do it in VBA.

    Thanks,
    julie

  2. #2
    Join Date
    Sep 2002
    Location
    Berlin, Germany
    Posts
    4
    Hi Julie,

    Make sure that your VBA References include an entry for Microsoft DAO 3.6 Object Library and change in the code the declarations
    Code:
    Dim rst As DAO.Recordset
    Dim db As DAO.Database
    hth nouba

Posting Permissions

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