Know your ISP.

breath-hyenas
User #292563   13 posts
Forum Regular

Hi guys. I got one question here. Please help me if you guys happen to know that.

I am working on report based on the access. My plan is to use form to support report in access. To achieve this, I use combo box link to one field of a table such event_category. Then it will show all content in the list.
E.g Event_category : professional learning
teaching support
curriculum support
However, I could not choose all of them in this way, only can choose one of them.

Do you know how to set choose all 3. then I can get all of them in the report.

Cheers

reference: whrl.pl/RbVLrQ
posted 2009-Jul-2, 3pm AEST
User #177443   595 posts
Whirlpool Enthusiast

You need to use a List Box rather than combo and set the Multi Select property of the List Box to simple or extended.

reference: whrl.pl/RbVLAJ
posted 2009-Jul-2, 3pm AEST
User #292563   13 posts
Forum Regular

how to get it?

reference: whrl.pl/RbVLCq
posted 2009-Jul-2, 3pm AEST
User #162600   563 posts
Whirlpool Enthusiast

where did you get the combo box?

reference: whrl.pl/RbVLDj
posted 2009-Jul-2, 3pm AEST
User #177443   595 posts
Whirlpool Enthusiast

Get what?

reference: whrl.pl/RbVLDC
posted 2009-Jul-2, 3pm AEST
User #30842   3758 posts
Whirlpool Forums Addict

OK

You have a combo box.
You have this referenced in your query that the report is run from. (Parameter)

[Forms]![frmYourForm]![cboMyCombo] Or Like [Forms]![frmYourForm]![cboMyCombo] Is Null

So choosing nothing chooses them all.

I always put in the label, "Choose one or leave blank for all."

reference: whrl.pl/RbVLFj
posted 2009-Jul-2, 4pm AEST
User #177443   595 posts
Whirlpool Enthusiast

I like to have a check box to select all which also enables / disables the combo

reference: whrl.pl/RbVLHG
posted 2009-Jul-2, 4pm AEST
User #292563   13 posts
Forum Regular

OK. Here is my question. When I use IIf function in my parameter query. I met one porblem. The form will remain the old input record, although I leave combo box blank this time. e.g. If I choose professional Learning last time. I did not choose any thing this time, it will still show last time result.
Here is my code in parameter criteria bulider:

=IIf(IsNull([Forms]![Form1]![Event Category]),[lk_Event_Category]! [Event_Category_Description],[Forms]![Form1]![Event Category])

Any way to solve that?

And , for check box method, I am thinking about it. but I do not know how set this event in parameter builder? Can you show me how to use it? just give me a example?

Cheers

reference: whrl.pl/RbVLJ4
posted 2009-Jul-2, 4pm AEST
User #30842   3758 posts
Whirlpool Forums Addict

My be try a refresh?

reference: whrl.pl/RbVLO8
posted 2009-Jul-2, 4pm AEST
User #292563   13 posts
Forum Regular

Thats my point, I am not sure which one I should use to get that? And how?
This really piss me off.
W8ing for reply and I keeping working on that...

reference: whrl.pl/RbVNWt
posted 2009-Jul-3, 8am AEST
User #30842   3758 posts
Whirlpool Forums Addict

Try a me.refresh

I dont think a me.requery is neccessary here.

reference: whrl.pl/RbVObA
posted 2009-Jul-3, 10am AEST
User #292563   13 posts
Forum Regular

I used Form.refresh to solve it.
Now I can use IIF function to select all items in the list ..
However, new issue is process is quite slow. Any good ideas to make it faster.

I set 4 IIF function as parameter query in the query....

reference: whrl.pl/RbVPJH
posted 2009-Jul-3, 4pm AEST
User #181895   149 posts
Forum Regular

Have a ListBox and set Multi Select to simple.

Create a button to view the report.

Create a private function like the following.

Private Function GetCriteria() As String
Dim stDocCriteria As String
Dim VarItm As Variant
For Each VarItm In ListFilter.ItemsSelected ' ListFilter is the name of the listbox
stDocCriteria = stDocCriteria & "[ItemID] = " & ListFilter.Column(0, VarItm) & " OR "
Next
If stDocCriteria <> "" Then
stDocCriteria = Left(stDocCriteria, Len(stDocCriteria) – 4)
Else
stDocCriteria = "True"
End If
GetCriteria = stDocCriteria
End Function

Then use the following button on click event to open the report.

Private Sub ButtonOpen_Click()
DoCmd.OpenReport "rpt_Item", acViewPreview, , GetCriteria()
End Sub

Hope This helps

reference: whrl.pl/RbVYTr
posted 2009-Jul-5, 10pm AEST
Hosted by
Bulletproof Managed Hosting
Big numbers
1,668,889 threads
32,921,414 posts
3,365,326 whims sent
3,986 wiki topics
195 ISPs listed
10,178 broadband plans
1,268 modems & routers
59,837 features filled