Consulting

Results 1 to 3 of 3

Thread: Solved: parameter declaration issue

  1. #1

    Solved: parameter declaration issue

    Gents,

    It seems that I've ran into a parameter handling issue that I've not learned yet, and haven't been able to find.... (Pretty novice .....)

    I try to run a selection query that selects records that contain three parameters the user can select from combo boxes on a form.

    The form is a continues form of this query.
    In the Query, I have the criteria set up as follows:

    Like [Forms]![Changedata]![TxtDescription]
    Where the TxtDescription refers to the first combo box.
    (And so the two others.)
    The form also contains a button to activate the Query. However, when I activate it, I get the error: Too few parameters, expected 3

    The code of the button starts with:

    Dim Rschangedata As Recordset
    Set Rschangedata = CurrentDb.Openrecordset ("Changedata")

    (Where Changedata is the name of the query)

    The stupid thing is, when I write the SQL code into the VBA section of the form, it works the way it should, but I would like to use the query itself.

    Can somebody help me with this???

    Johan

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    johan, are you putting the parameter in the Query's parameters or in the Criteria Row of the Query?
    Why are you using a Recordset for the Query rather than displaying the query or a form based on it?

  3. #3
    I am putting the parameter in the criteria row of the query.

    I use the recordset, because based on these three parameters, I select a specific record. Then I use the form also to make it possible to change other fields of this specific record.
    (The combination of these 3 parameters results by definition in one record.)

Posting Permissions

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