A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

ACC2000: save WHERE clause to report via code



 
 
Thread Tools Display Modes
  #1  
Old January 29th, 2008, 02:24 PM posted to microsoft.public.access.reports
A Man
external usenet poster
 
Posts: 29
Default ACC2000: save WHERE clause to report via code

I have a report where I need to save the WHERE clause to it, so another
routine (which I did not write) can open the report and create a PDF
from it.

How do I do this via code?

Thank you.
  #3  
Old January 29th, 2008, 03:04 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default ACC2000: save WHERE clause to report via code

You could create a table with fields to store your criteria values. Add this
single record table to your report's record source query and use the criteria
fields as criteria.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"A Man" wrote:

In article ,
says...
I have a report where I need to save the WHERE clause to it, so another
routine (which I did not write) can open the report and create a PDF
from it.

How do I do this via code?

Thank you.

p.s. My report is not opened via the docmd.openreport command, hence the
need to save the WHERE information directly in the report itself.

  #5  
Old January 29th, 2008, 04:09 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default ACC2000: save WHERE clause to report via code

If you really want to change the recordsource of a report, search google on
Access Reports "me.recordsource"
You will get tons of hits.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


"A Man" wrote:

In article ,
says...
You could create a table with fields to store your criteria values. Add this
single record table to your report's record source query and use the criteria
fields as criteria.


Ok. I think I will change the report's recordsource property using a
different SQL statement for each customer, then call Leban's ConverToPDF
function.

How do I change the report's .Recordsource property in code?

  #6  
Old January 29th, 2008, 04:13 PM posted to microsoft.public.access.reports
A Man
external usenet poster
 
Posts: 29
Default ACC2000: save WHERE clause to report via code

I tried the following but got an error:

sWhere = "[cus_no] = '" & sCustnum & "'"
Reports!DealerOrder2.Filter = sWhere
Reports!DealerOrder2.FilterOn = True


The error was '2451: The report name "DealerOrder2" you entered is
misspelled or refers to a report that isn't open or doesn't exist.'

So, I can open the report via Docmd.Openreport, but how do I close it
after I updated the properties .Filter and .Filteron?

Thank you.

p.s. Opening each report, for 800+ customers, is very time-consuming
also. It might take each report 1 minute to preview, times 800
customers, that's 800 minutes to process all customers. Which is why I
wanted a direct way, without using Docmd.Openreport, to update the
report properties directly.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.