473,411 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

A form to enter report criteria...(couldn't think of a better subject!!)

Hi everybody, your help will be very much appreciated.

I have a form that allows the user to set a criteria before opening the
report. It has 2 combo boxes lets call them A and B. A= the clients
names, and B= the documents we have in the DB. Each client has many
documents. If both combo boxes are left empty the report lists all the
clients with all their documents.

What I want to do now is as follows; when the user leaves cbo A empty
and selects, for example, a certain document in cbo B --> the report
should list all the available documents under the type selected (in cbo
B) for all the available clients. (note: the report is grouped 1st by
the "client", and 2nd by the 'type of document".) Or visa versa
selecting a client in cbo A and leaving cbo B empty --> the report
should list all the documents available for the selected client.

Did I make too complicated? Hope not!

Thanks for your cooperation.

Louly

Jun 22 '06 #1
3 1333
"Louly" <mi*****@gmail.com> wrote in message
news:11**********************@y41g2000cwy.googlegr oups.com...
Hi everybody, your help will be very much appreciated.

I have a form that allows the user to set a criteria before opening the
report. It has 2 combo boxes lets call them A and B. A= the clients
names, and B= the documents we have in the DB. Each client has many
documents. If both combo boxes are left empty the report lists all the
clients with all their documents.

What I want to do now is as follows; when the user leaves cbo A empty
and selects, for example, a certain document in cbo B --> the report
should list all the available documents under the type selected (in cbo
B) for all the available clients. (note: the report is grouped 1st by
the "client", and 2nd by the 'type of document".) Or visa versa
selecting a client in cbo A and leaving cbo B empty --> the report
should list all the documents available for the selected client.

Did I make too complicated? Hope not!

Thanks for your cooperation.


Hi Louly.

What you need to do is build a SQL string to use as a WHERE clause for the
OpenReport method. Try something like this in a command button's click
event (untested):

Dim strSQL As String
If Not IsNull Me.cboA Then
strSQL = "[FieldA] = " & Me.cboA
If Not IsNull Me.cboB Then strSQL = strSQL & " And "
End If
If Not IsNull Me.cboB Then strSQL = strSQL & "[FieldB] = " & Me.cboB

DoCmd.OpenReport "rptMyReport", acViewPreview,, strSQL

HTH - Keith.
www.keithwilby.com
Jun 22 '06 #2
Thank you Keith for the prompt reply.

This question may sound stupid; I don't get what you mean by [FieldA]
and [FieldB].

Lou
Keith Wilby wrote:
"Louly" <mi*****@gmail.com> wrote in message
news:11**********************@y41g2000cwy.googlegr oups.com...
Hi everybody, your help will be very much appreciated.

I have a form that allows the user to set a criteria before opening the
report. It has 2 combo boxes lets call them A and B. A= the clients
names, and B= the documents we have in the DB. Each client has many
documents. If both combo boxes are left empty the report lists all the
clients with all their documents.

What I want to do now is as follows; when the user leaves cbo A empty
and selects, for example, a certain document in cbo B --> the report
should list all the available documents under the type selected (in cbo
B) for all the available clients. (note: the report is grouped 1st by
the "client", and 2nd by the 'type of document".) Or visa versa
selecting a client in cbo A and leaving cbo B empty --> the report
should list all the documents available for the selected client.

Did I make too complicated? Hope not!

Thanks for your cooperation.


Hi Louly.

What you need to do is build a SQL string to use as a WHERE clause for the
OpenReport method. Try something like this in a command button's click
event (untested):

Dim strSQL As String
If Not IsNull Me.cboA Then
strSQL = "[FieldA] = " & Me.cboA
If Not IsNull Me.cboB Then strSQL = strSQL & " And "
End If
If Not IsNull Me.cboB Then strSQL = strSQL & "[FieldB] = " & Me.cboB

DoCmd.OpenReport "rptMyReport", acViewPreview,, strSQL

HTH - Keith.
www.keithwilby.com


Jun 22 '06 #3
"Louly" <mi*****@gmail.com> wrote in message
news:11*********************@y41g2000cwy.googlegro ups.com...
Thank you Keith for the prompt reply.

This question may sound stupid; I don't get what you mean by [FieldA]
and [FieldB].


Just replace them with your real field names (client names and documents).

Regards,
Keith.
Jun 22 '06 #4

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

Similar topics

3
by: pelcovits | last post by:
I am trying to set up an unbound form to enter report criteria. I've followed the MS Office Assistance document: "Create a form to enter report criteria" which describes how to enter data (such...
3
by: Simone | last post by:
Hi, I'm a DB newbie and I've been having issues trying to print the record I am viewing in a form to a report. I have looked in groups all over and they all say to try basically the same thing...
3
by: duncedunce | last post by:
Hi Have 'googled' and no luck (after 2 hours!) - hope someone here can help. Access 2003 I am looking (for a visually impaired student of mine) at how to insert unbound controls in to a...
11
by: ian.davies52 | last post by:
Is there anything I can do about the apparent limit on the number of textboxes that have calculations as their control source on a form or report in ms-access? I have a query that pulls together...
0
by: Saintor | last post by:
I have a combo connected to a table, description and its code. Bound column is 2 (code) and widths are at 2";0.5". When not expanded, the combo shows the description only Is there a way to...
1
by: Louly | last post by:
Create a form to enter report criteria? Anyone can help me with this? I don't want to do it using the Macros method. Is there a way to do it using VBA? Thanks for your cooperation. Louly
4
by: sara | last post by:
Hi - I've looked at many posts, and cannot find the answer on this specific problem. I have several fields on a table, which I've defined as "Text", 3 characters, Format Yes/No (I picked up the...
7
by: Randoz | last post by:
I have created a form per MS Access help for search criteria for a reportand it works great. But is there a way to do it for an edit form? I have duplicated the method and can get 95% of the...
7
by: arali | last post by:
I have made a database in Access I made a report criteria form on which i use to datpickers dtpicker0 and dtpicker1 and two command button open button is used to open the report...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.