opening report from form

jclaydon

Registered User.
Local time
Today, 22:42
Joined
Jul 29, 2004
Messages
11
Hi,

Have done a search of the forums and can't seem to find an answer to this.

Am trying to open up a report dependent on selection in a list box.

Example.

Have a list of courses, need to code the open report button to open the report, filtered on the selection from the list box.

Any ideas?
 
Report should be based on a query, Use the list box as criteria in query.

Open report based from On Click Property of list box.

Not done it this way myself. Generally use combo boxes in similar manner

L
 
Keep getting a syntax error, when trying this.

Any examples of code I can look at?

Thanks
 
syntax problem on query supporting the report or calling the report


Copy and paste the sql/code here


As i said I generally use conbo box



Len
 
Am trying this:

Dim stDocName As String

stDocName = "Leaflets"
DoCmd.OpenReport stDocName, acPreview, , "[6th_Form_Prospectus_Title] = " & Me.lsttitle.Column(0)



Recognizes the right value for the field but comes up with:

"Syntax error (missing operator) in query expression...."

Any ideas?
 
Looks like the problem is with the query on which the form is based. Post the sql of the query

When I am opening a report I use

DoCmd.OpenReport "Report Name",acPreview

Len
 
How do I use the list box/combo box as the criteria in the query?
 
Have the Form open

Open query in design view

Click in to criteria in the query grid below the field you want to set up criteria for.

Right Click Select Builder

Select Code Builder

Select Forms

Select Open forms

Select the List box (by its name)

You will now see the expression has been built for you.

Click Okay and the code is pasted to your query

Close and save query

Len
 

Users who are viewing this thread

Back
Top Bottom