G
Guest
Hi!
In a form, I have two listboxes. The user selects one option from any of the
two boxes and then clicks on a preview or print button to view a report. Each
option opens a different report.
When I select one of the listboxes, I want the other one to be reseted and
have no item selected.
I tried many ways to do this and it worked perfectly. The listbox was
reseted, but then, my preview and print button no longer work. I get no error
but when I click on these buttons, nothing happens... However, when there was
no code for reseting the listboxes, the print and preview buttons worked if
only one option from the listboxes wa selected.
Can someone help me out? I work in access 2000
Here's my code: the print and preview buttons were created the same way as
the buttons used in the NorthWind access examples. The default value of the
two listboxes is none selected.
sub PrintReports(Printmode As Integer)
dim ReportName, Condition As String
select case Me!List1 & Me!List2
Case "employees report"
ReportName="EmployeesReport"
Condition=""
'.....
Case "Vehicule report"
'..... and so on...
end select
docmd.openreport ReportName, Printmode, , Condition
end sub
' Here'S the code I designed for reseting the other listbox while one has
the focus
Private Sub List1_Click()
dim n As integer
for n=1 to me.list2.listcount
me.list2.selected(n) =false
next n
end sub
' I also tried Me.list2.defaultvalue =true (Where the default value is none
selected) and it also worked for the reseting part. But then, as I said,
print doesn't work anymore
thanks for helping
Louis Pat
In a form, I have two listboxes. The user selects one option from any of the
two boxes and then clicks on a preview or print button to view a report. Each
option opens a different report.
When I select one of the listboxes, I want the other one to be reseted and
have no item selected.
I tried many ways to do this and it worked perfectly. The listbox was
reseted, but then, my preview and print button no longer work. I get no error
but when I click on these buttons, nothing happens... However, when there was
no code for reseting the listboxes, the print and preview buttons worked if
only one option from the listboxes wa selected.
Can someone help me out? I work in access 2000
Here's my code: the print and preview buttons were created the same way as
the buttons used in the NorthWind access examples. The default value of the
two listboxes is none selected.
sub PrintReports(Printmode As Integer)
dim ReportName, Condition As String
select case Me!List1 & Me!List2
Case "employees report"
ReportName="EmployeesReport"
Condition=""
'.....
Case "Vehicule report"
'..... and so on...
end select
docmd.openreport ReportName, Printmode, , Condition
end sub
' Here'S the code I designed for reseting the other listbox while one has
the focus
Private Sub List1_Click()
dim n As integer
for n=1 to me.list2.listcount
me.list2.selected(n) =false
next n
end sub
' I also tried Me.list2.defaultvalue =true (Where the default value is none
selected) and it also worked for the reseting part. But then, as I said,
print doesn't work anymore
thanks for helping
Louis Pat