473,513 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

filter on form with VBA

Hi,

Im using such procedure on my form to filtering dates to raport:
Private Sub wyswietlraport Click()
Dim i As Integer
Dim Indexgorny As Integer
Dim warunek As String
Dim klienci() As String
If bpolewyboru = True Then
For I = 0 To Lstklienci.ListCount - 1
If Lstklienci.Selected(i) = True Then
Indexgorny = Indexgorny + 1
ReDim Preserve klienci(1 To Indexgorny)
klienci(Indexgorny) = "klient = " & "'" &
Lstdyscypliny.Column(0, i) & "'"
End If
Next I

warunek = Join(klienci, " Or ")
DoCmd.OpenReport
ReportName:="raportklienci1",
view:=acViewPreview,
wherecondition:=warunek
DoCmd.Close acForm, "frmFiltr1"
End Sub

This procedure is creating date box klient from where I can choose one
or few
value of klient and print report. When I choose a few values raport is
printed
with those (one raport with a few value of klient) But I would like
when I choose a few value of klient raport was printing for each value
separately.
For example when I mark klient1, klient2, klient5 raport is printing
for klient1 value first than klient2 value and klient5. Maybe someone
had similar problem earlier and know how to change procedure so that
to get such posibility.
Thanks for any help

Peter

Nov 13 '05 #1
2 1645
Peter,
If you loop through the .ItemsSelected collection of the listbox and
open a report for each one, you use the Where condition to filter each
one. Instead of OR-ing them together, you can just do something like

for each varItem in lbx.ItemsSelected
docmd.OpenReport "raportklienci1",acViewPreview, warunek
'print the report or whatever
docmd.Close... 'close the report
next varItem

Nov 13 '05 #2

<to**@wp.pl> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,

Im using such procedure on my form to filtering dates to raport:
Private Sub wyswietlraport Click()
Dim i As Integer
Dim Indexgorny As Integer
Dim warunek As String
Dim klienci() As String
If bpolewyboru = True Then
For I = 0 To Lstklienci.ListCount - 1
If Lstklienci.Selected(i) = True Then
Indexgorny = Indexgorny + 1
ReDim Preserve klienci(1 To Indexgorny)
klienci(Indexgorny) = "klient = " & "'" &
Lstdyscypliny.Column(0, i) & "'"
End If
Next I

warunek = Join(klienci, " Or ")
DoCmd.OpenReport
ReportName:="raportklienci1",
view:=acViewPreview,
wherecondition:=warunek
DoCmd.Close acForm, "frmFiltr1"
End Sub

This procedure is creating date box klient from where I can choose one
or few
value of klient and print report. When I choose a few values raport is
printed
with those (one raport with a few value of klient) But I would like
when I choose a few value of klient raport was printing for each value
separately.
For example when I mark klient1, klient2, klient5 raport is printing
for klient1 value first than klient2 value and klient5. Maybe someone
had similar problem earlier and know how to change procedure so that
to get such posibility.
Thanks for any help

Peter

Can you alter the design of the report so it produces, for example, one page
per client. This way the same code will work, just with a slightly
different report.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7830
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside...
0
6454
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
2
9773
by: Andante.in.Blue | last post by:
Hi everyone! I was wondering if there is a away to use Access 97's build in filter-by-form function but restrict its effect to just the subform. I have a parent form that shows the major...
3
6593
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
1
4538
by: jeffgeorge | last post by:
Hi all. Trying to move Filter By Selection, Filter By Form, and Apply/Remove Filter directly into my form. No luck. Is there anyway to move them into the header of the form or, as another...
7
6260
by: damjanu | last post by:
Hi All; I need little help. I have a datasheet form. I allow user to do 'filter by selection'. My form contains a column with values. As user changes selections, I want to calculate totals....
8
6512
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and...
2
5016
by: Salad | last post by:
I have a log file with a list of records. The log file can be unfiltered or filtered. I have a command button to call a data entry form from the log. At first I was only going to present the...
2
2822
by: cefrancke | last post by:
I have a form (no underlying record set) that has two separate sub-forms on it. Each sub-form has data from two different tables. Above each sub-form there is one unbound combo box with a SQL...
1
6767
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7539
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5089
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.