cascading reports based on VB script

N

nicolascaprais

Hello, - I am using Access 2k2 and Windows XP Pro-

I have a form with cascading combo boxes, these comboboxes act as
filters on the results shown on a report. This report gives the name of
a company.
here's the code for this:


Private Sub Command28_Click()

Dim strSQL As String
Dim intCounter As Integer

'Build SQL String
For intCounter = 1 To 2
If Me("Filter" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " & " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " And "
Else

End If
Next

'special provision for reliability

If Me("Filter" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " & Me("Filter" & intCounter) & " And "
End If

If strSQL <> "" Then
'Strip Last " And "
strSQL = left(strSQL, (Len(strSQL) - 5))
'Set the Filter property
Reports![rptCustomers].Filter = strSQL
Reports![rptCustomers].FilterOn = True

Else
Reports![rptCustomers].FilterOn = False
End If

End Sub

My problem is that this first report [rptCustomers] does not contain all
the information of the table from which it lists the content (as it only
shows the company name), and that I created a second report named
[rptCordisDetails] which contains more detailed information on the
result (company) shown on the first form.

How could I edit this code so that the report [rptCordisDetails] shows
all the details of the selection made with the filters on my first
report [rptCustomers].

I manage to show the name of the company appearing in my[rptCustomers]
report by inputing the value "=États!rptCustomers![Entreprise Cordis]"
to the entreprise value of my [rptCordisDetails] report.

But, since the other values aren't displayed on the first form I don't
know how to display the rest of the data associated with this entry...

Should I create a query or table based on the filtering results (for
example the value of the variable strSQL) and use this query as the
values for my [rptCordisDetails] report????

Thanks to anyone who can help!!!

Cheers
nico
 

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