Hi All,

I have access database with a form which has combo boxes which get populated with queries and they are interlinked with query for e.g. Combobox1 gets populated with region and combobox2 gets populated with the country in that region so if you select "Asia" Region in Combobox1 then Combobox2 will get populated with countries like "Singapore", "Japan", "Hongkong" etc. Now you will have to select one of the country and then print report and need to do the same exercise for all regions. Now this means that whenever the selection in combobox1 selection changes the combobox2 requeries it's data in order to populate the respective region countries in it.I want the code to print the files to pdf using "pdfcreator" as printer and then save the files on a specfic path like "C:\".



Below is the code which I have worked on so far but it shows an error that is Run-time error '3061': Too few parameters. Expected 1:

Code:
Private Sub Commandbutton_Click ()
Dim rst As DAO.Recordset
Dim CustomerID As Long
Set rst = CurrentDb.OpenRecordset("Query1", dbOpenSnapshot)
Debug.Print rst
With rst
    Do Until .EOF
        ProgramID = !ProgramID
        DoCmd.OpenReport "StrptReport", acViewPreview, , "CustomerID=" & CustomerID
       Reports![StrptReport].Caption = [FullReportName]
        Name "StrptReport" As [FullReportName] & ".pdf"
        .MoveNext
    Loop
    .Close
End With
Set rst = Nothing
End sub
When I click on the debug error It highlights the below line from code:
Code:
Set rst = CurrentDb.OpenRecordset("Query1", dbOpenSnapshot)

Thanks a lot for your help in advance.