Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    Myanmar (Burma)
    Posts
    42

    Red face Unanswered: Need Help about "Parameter Query"

    Hi ALL

    I have a report that was generated from parameter query.
    I want to put a command button on my form, when I need to print current record and related child records, just click on that button to view the report preview.
    But now, when I press this button "Enter Parameter value" dialog box was always appear. I dont want to re-type the DNo, that was already appear on the form.
    But I don't know how to pass that data with VB code.

    My SQL query code is .....

    SELECT tblRR.*, tblMD.*, [DNum] AS Exp1
    FROM tblMD RIGHT JOIN tblRR ON tblMD.DNo = tblRR.DNo
    WHERE ((([DNumber])=[tblRR].[DNo]))

    My VB code for command button is ....

    Private Sub cmdDRPreView_Click()

    DoCmd.Close
    DoCmd.OpenReport "rptDRList", acViewPreview

    End Sub


    Thanks in advance

    mmlatt

  2. #2
    Join Date
    Jan 2004
    Location
    Romania - Bucharest
    Posts
    50
    You should put on your form a field where the user will input the value of the parameter you intend to use in the query.

    Then you should change the query to use the value of that control on the form.

    That is, instead of

    SELECT ... FROM ... WHERE ... = [Enter your param here: ]

    to:

    SELECT ... FROM ... WHERE ... = Forms!My_Form_Name!My_Control_Name.Value

    or something like that...

  3. #3
    Join Date
    Jan 2004
    Location
    Myanmar (Burma)
    Posts
    42
    Originally posted by marp
    You should put on your form a field where the user will input the value of the parameter you intend to use in the query.

    Then you should change the query to use the value of that control on the form.

    That is, instead of

    SELECT ... FROM ... WHERE ... = [Enter your param here: ]

    to:

    SELECT ... FROM ... WHERE ... = Forms!My_Form_Name!My_Control_Name.Value

    or something like that...
    Thanks alot marp.

Posting Permissions

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