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  

Running Report_Open Code



 
 
Thread Tools Display Modes
  #1  
Old January 15th, 2010, 04:21 PM posted to microsoft.public.access.reports
dan
external usenet poster
 
Posts: 1,408
Default Running Report_Open Code

I am calling an Access Report from an Access VB Module. The Access Report has
Report_Open code that should execute when the report runs. When I call the
report from the VB code the report code does not execute. If I run the report
just by opening the report the code does execute. Calling the code from VB
had been working for years but now the Report_Open fails to even execute when
calling the report from VB code. Does anyone know why Access is doing this?
  #2  
Old January 15th, 2010, 05:55 PM posted to microsoft.public.access.reports
Dale Fye
external usenet poster
 
Posts: 2,651
Default Running Report_Open Code

Dan,

1. What version of Access are you using?

2. What does the line of code look like that opens the report?

3. Is the report in the same mdb/accdb file as the code that opens it?

4. What does the code in the reports Open event look like? I assume you
have already tried putting a breakpoint in this code to see what is
happening. Have you opened the report in design mode and confirmed that the
Open event on the Events tab of the properties dialog says:
[Event Proceedure]? If not, check that.

HTH
Dale

"Dan" wrote in message
...
I am calling an Access Report from an Access VB Module. The Access Report
has
Report_Open code that should execute when the report runs. When I call the
report from the VB code the report code does not execute. If I run the
report
just by opening the report the code does execute. Calling the code from VB
had been working for years but now the Report_Open fails to even execute
when
calling the report from VB code. Does anyone know why Access is doing
this?



  #3  
Old January 15th, 2010, 07:36 PM posted to microsoft.public.access.reports
dan
external usenet poster
 
Posts: 1,408
Default Running Report_Open Code

Thanks for the reply.

the version is Access 2003

this is the code that opens the report from the VB module:
DoCmd.OpenReport "R_TicketSingle", acViewNormal

The report is in the same .mdb file

I have put a break point in the report code, when I open/run the report the
code does hit the break point. But when the report is called from the VB
module the code does not hit the break point.

The report does have the [Event Proceedure] on the "On Open". When I click
the "..." button it does take me to the code.


"Dale Fye" wrote:

Dan,

1. What version of Access are you using?

2. What does the line of code look like that opens the report?

3. Is the report in the same mdb/accdb file as the code that opens it?

4. What does the code in the reports Open event look like? I assume you
have already tried putting a breakpoint in this code to see what is
happening. Have you opened the report in design mode and confirmed that the
Open event on the Events tab of the properties dialog says:
[Event Proceedure]? If not, check that.

HTH
Dale

"Dan" wrote in message
...
I am calling an Access Report from an Access VB Module. The Access Report
has
Report_Open code that should execute when the report runs. When I call the
report from the VB code the report code does not execute. If I run the
report
just by opening the report the code does execute. Calling the code from VB
had been working for years but now the Report_Open fails to even execute
when
calling the report from VB code. Does anyone know why Access is doing
this?



.

  #4  
Old January 15th, 2010, 10:07 PM posted to microsoft.public.access.reports
Dale Fye
external usenet poster
 
Posts: 2,651
Default Running Report_Open Code

Sorry, Dan

Cannot say that I've ever run into that situation.

Have you tried putting the code in the Load event instead of the open event?
What does the code that is currently in the Open event do?

Dale

"Dan" wrote in message
...
Thanks for the reply.

the version is Access 2003

this is the code that opens the report from the VB module:
DoCmd.OpenReport "R_TicketSingle", acViewNormal

The report is in the same .mdb file

I have put a break point in the report code, when I open/run the report
the
code does hit the break point. But when the report is called from the VB
module the code does not hit the break point.

The report does have the [Event Proceedure] on the "On Open". When I click
the "..." button it does take me to the code.


"Dale Fye" wrote:

Dan,

1. What version of Access are you using?

2. What does the line of code look like that opens the report?

3. Is the report in the same mdb/accdb file as the code that opens it?

4. What does the code in the reports Open event look like? I assume you
have already tried putting a breakpoint in this code to see what is
happening. Have you opened the report in design mode and confirmed that
the
Open event on the Events tab of the properties dialog says:
[Event Proceedure]? If not, check that.

HTH
Dale

"Dan" wrote in message
...
I am calling an Access Report from an Access VB Module. The Access
Report
has
Report_Open code that should execute when the report runs. When I call
the
report from the VB code the report code does not execute. If I run the
report
just by opening the report the code does execute. Calling the code from
VB
had been working for years but now the Report_Open fails to even
execute
when
calling the report from VB code. Does anyone know why Access is doing
this?



.



  #5  
Old January 17th, 2010, 01:26 AM posted to microsoft.public.access.reports
Armen Stein[_2_]
external usenet poster
 
Posts: 157
Default Running Report_Open Code

On Fri, 15 Jan 2010 17:07:00 -0500, "Dale Fye"
wrote:

Cannot say that I've ever run into that situation.

Have you tried putting the code in the Load event instead of the open event?
What does the code that is currently in the Open event do?


Whenever we see weird behavior like this, the compiled VBA code is
suspect.

I assume you have a good backup and you've already run Compact/Repair
on your database.

I suggest that you:

- use the under-documented /Decompile startup switch to make sure your
VBA isn't corrupted

If that doesn't work,

- make a brand new empty Access database, then copy all your objects
into it and try it from there.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com

  #6  
Old January 19th, 2010, 07:25 PM posted to microsoft.public.access.reports
dan
external usenet poster
 
Posts: 1,408
Default Running Report_Open Code

What is strange is the when I have the report in design mode and call the
report from the VB code it will execute the code every time. If I close the
report and run the VB code the report code does not execute.

  #7  
Old January 19th, 2010, 08:56 PM posted to microsoft.public.access.reports
Armen Stein[_2_]
external usenet poster
 
Posts: 157
Default Running Report_Open Code

On Tue, 19 Jan 2010 11:25:01 -0800, Dan
wrote:

What is strange is the when I have the report in design mode and call the
report from the VB code it will execute the code every time. If I close the
report and run the VB code the report code does not execute.


All the more reason to suspect the compiled VBA code. Did you try my
earlier suggestions?

Armen Stein
Microsoft Access MVP
www.JStreetTech.com

  #8  
Old January 19th, 2010, 09:31 PM posted to microsoft.public.access.reports
dan
external usenet poster
 
Posts: 1,408
Default Running Report_Open Code

I needed to call the report from code to see why the report filtering was not
functioning. For some reason I needed to add Me.FilterOn = True to have the
report filter for just one item. For some reason the report stopped filtering
even though the Filter was filled in. My guess is the report was resaved with
FilterOn turned off. This cause the report to stop functioning.

As to the reason for my post. This is not a solved issue. When calling the
report from VB code DoCmd.OpenReport "R_TicketSingle", acViewNormal it will
skip showing the running of the Report Code. when it skipped this I was
unable to verify why my report filter was not working. It would just print
everything out.

If in the VB code I
DoCmd.OpenReport "R_TicketSingle", acDesign
DoCmd.OpenReport "R_TicketSingle", acViewNormal
DoCmd.Close acReport, "R_TicketSingle"

the code would now break inside the report where I had set the break point.
This is how I found out it was the Me.FilterOn was causing my problem.

I am not sure if this behavior is by design or not but I am glad I was able
to solve my issue. Thanks for the help.
 




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 05:01 AM.


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