473,503 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using queries to pull up reports...

47 New Member
Hey,

Have been working on a project which requires a report to be pulled when a query is run. Pulling the report is something i have done, but if i have to filter the reports to pull up only certain data is something which i havent been able to master. Is that possible. To filter data in a report something like we do in a excel sheet??
Jun 16 '08 #1
6 2632
RuralGuy
375 Recognized Expert Contributor
The WhereCondition argument of the OpenReport command simply applies a filter to the report. That sounds like the answer you were looking for but I'm not sure.
Jun 16 '08 #2
neosam
47 New Member
The WhereCondition argument of the OpenReport command simply applies a filter to the report. That sounds like the answer you were looking for but I'm not sure.
Hey, could you let me know how do you declare a where condition. is it like a seperate function?
Jun 18 '08 #3
JKing
1,206 Recognized Expert Top Contributor
Hey, could you let me know how do you declare a where condition. is it like a seperate function?
Hey there,

The OpenReport command like many other commands has several parameters or arguments that you can use to change how the report acts when opened. If you don't specify all the parameters the default settings are used.

Here is what all the arguments are:

OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)

The only required argument is a report name. You can leave an optional argument blank in the middle of the syntax, but you must include the argument's comma. If you leave one or more trailing arguments blank, don't use a comma following the last argument you specify.

In your case I think you only want to use the report name and the where condition. This would look something like the following:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "myReport", , , "ID = 'ABC1' "
  2.  
myReport would be the name of the report you want to open and ID is a field you want to be filtered to show only ABC1.

If you need help forming your where condition to your specific case feel free to ask and provide some information as to what fields you need filtered and their data type.

Good luck,
Jking
Jun 18 '08 #4
neosam
47 New Member
Hey there,

The OpenReport command like many other commands has several parameters or arguments that you can use to change how the report acts when opened. If you don't specify all the parameters the default settings are used.

Here is what all the arguments are:

OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)

The only required argument is a report name. You can leave an optional argument blank in the middle of the syntax, but you must include the argument's comma. If you leave one or more trailing arguments blank, don't use a comma following the last argument you specify.

In your case I think you only want to use the report name and the where condition. This would look something like the following:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "myReport", , , "ID = 'ABC1' "
  2.  
myReport would be the name of the report you want to open and ID is a field you want to be filtered to show only ABC1.

If you need help forming your where condition to your specific case feel free to ask and provide some information as to what fields you need filtered and their data type.

Good luck,
Jking
Hi Jking,

This works but it does not open the report in a .xls format, but in a .mdi format.
The code i have used is
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "myReport", , , "Date = TxtBox "
  2.  
where TxtBox is a text box where user needs to type a date. When i do this application automatically opens a "Save As" Dialog box, but there is no .xls option.
Jun 18 '08 #5
JKing
1,206 Recognized Expert Top Contributor
Hi Jking,

This works but it does not open the report in a .xls format, but in a .mdi format.
The code i have used is
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "myReport", , , "Date = TxtBox "
  2.  
where TxtBox is a text box where user needs to type a date. When i do this application automatically opens a "Save As" Dialog box, but there is no .xls option.
Sorry, I think you also need to add the view argument. You probably want acViewPreview.

If you want to use a control in the where clause you would need to break it out of the quotes and reference it properly.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "myReport, acViewPreview , ,"Date = #" & Me.TxtBox & "#"
  2.  
Jun 18 '08 #6
neosam
47 New Member
Sorry, I think you also need to add the view argument. You probably want acViewPreview.

If you want to use a control in the where clause you would need to break it out of the quotes and reference it properly.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "myReport, acViewPreview , ,"Date = #" & Me.TxtBox & "#"
  2.  
Hi Jking,

Thanks a lot... it works...
Jun 19 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
4004
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
6
1983
by: Serious_Practitioner | last post by:
Good day all, and thank you in advance for your help. No - MANY thanks in advance for your help - I know nothing about using databases on Web servers. I am about to discuss a project with a...
10
2554
by: john | last post by:
I have a report to print envelopes. The report is based on a query. Now I need to make 10 more queries to make different selections of addresses. Every query has the same output fields as the...
1
1740
by: kkrizl | last post by:
I've tried to research this problem, and I haven't been able to find any references to it. Probably because I shouldn't be doing it, but it was working, and now it's not. I'm trying to develop a...
15
2862
by: Wes Groleau | last post by:
When I try to import from Access, the DTS wizard only allows me to import tables and queries. OK, I'm not surprised the "macros" and reports don't come over. But it executes each query, and...
14
6858
by: SemiNoviceProgramer | last post by:
Hi Every body I used access succefully for years and I created many scientefic databases with it Now I want to use VB.net2005 environmment with access database I succesfuly loaded my...
3
1977
by: Bob Alston | last post by:
I have recently been trying to determine the best technique to pull the least amount of info across the LAN link in a slow speed LAN situation (e.g. < 10 Mbps), where data volume = performance. ...
11
1993
by: Josetta | last post by:
I searched around a little bit, but didn't come up with the answer to this question, but somewhere in the back of my mind, I think this can be done... Let's say we have two different company...
14
6658
by: Supermansteel | last post by:
My team at work uses Cognos to run multiple queries to pull in data. Then they take that data and import into Access and then usually run an Append Query to run a RND function to pull out a few...
0
7204
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
7091
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
7282
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
7342
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
6998
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...
1
5018
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
4680
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
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.