Picture Report

G

Guest

Hi

On my reports form I have a command button that when you click it, it loads
a reportform on the criteria in my combo boxed. I have pasted the code
below. My problem is that it loads the report but for all the records and
not just the ones matching the criteria. What am i missing, I am only
learning VB so will need a clear answer.


Private Sub Command15_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.

strReport = "Items"

If Not IsNull(Me.Combo12) Then
If strWhere <> "" Then
strWhere = "(" & strWhere & ") AND (subid= """ & Me.Combo12 &
""")"
Else
Me.Combo12 = SubID
End If
End If

' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, strWhere


End Sub


Thanks

Andrew
 
G

Guest

Hi Andrew,

You aren't setting a value for strWhere, so it is never getting into that
portion of your if/then statement.

Damian.
 
G

Guest

Thnks Damian

Can you give me a bit more info on how to fix the problem so i can set the
value. I dont know much about VB and learning as i go

Thanks

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top