dynaset problem....

JCross

Registered User.
Local time
Today, 05:09
Joined
Feb 28, 2002
Messages
116
Hi! I have a recordset based on a query that is getting a 'too few parameters ' error. I think it is because I have a form referenced in the query that I need to set the value of? Is this right? I checked the KB article, but didn't quite understand it..

Thank you!
jennifer
 
Here's an example I use in a Dynamic Cross Tab Report, the important bit is in bold.


Code:
Private Sub Report_Open(Cancel As Integer)
    ' Create underlying recordset for report
    Dim intX As Integer
    Dim qdf As QueryDef
Me.RecordSource = strRepSource
Me.lblHeaderCaption.Caption = strRepCaption


    ' Set database variable to current database.
    Set dbsReport = CurrentDb

    ' Open QueryDef object.
    Set qdf = dbsReport.QueryDefs(strRepSource)

[b]' Set parameters for query based on values entered
    ' in EmployeeSalesDialogBox form.
    qdf.Parameters("Forms![frmAreaReport]![lstAreas]") _
        = Forms![frmAreaReport]![lstAreas]
[/b]
' Open Recordset object.
    Set rstReport = qdf.OpenRecordset()

    ' Set a variable to hold number of columns in crosstab query.
    intColumnCount = rstReport.Fields.Count

End Sub
 

Users who are viewing this thread

Back
Top Bottom