Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional cbx values

Status
Not open for further replies.

LHWC

Technical User
Apr 29, 2004
52
US
I have the following code that loads cbxCutSheet with all reports in the current project:

Dim rpt As AccessObject
Dim objCP As Object
Dim strReports As String

Set objCP = Application.CurrentProject

For Each rpt In objCP.AllReports
strReports = strReports & rpt.Name & ";"
Next rpt

cbxCutSheet.RowSourceType = "Value List"
cbxCutSheet.RowSource = strReports

I want to amend the code to limit the listed reports to those in a particular group, depending on the value of a second cbx. Specifically, whether the text "DH" or "CAS" appears in that text. A2002 DAO.
Any ideas? Thanks in advance.
 
Hi

Note sure I understand this part:

"I want to amend the code to limit the listed reports to those in a particular group, depending on the value of a second cbx. Specifically, whether the text "DH" or "CAS" appears in that text.

but in principle:

For Each rpt In objCP.AllReports
If Instr(1,"DH",rpt.name) > 0 OR
Instr(1,"CAS",rpt.name) > 0 Then
strReports = strReports & rpt.Name & ";"
end if
Next rpt


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken,
Sorry I wasn't clear. I have different reports for each condition, DH or CAS. They are seperated into Groups in the Object pane of the database window. For example in the following, I need to have strReports "look" only in the DH group of reports.

For Each rpt In objCP.AllReports
If Instr(cbxJobs,"DH") > 0 Then
strReports = strReports & rpt.Name & ";"
end if
Next rpt

Hope this is clearer, and thanks for your help!
EB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top