Access 2003 printing problem

B

Bob Hughes

I have a report with the following code

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
If Me.NumberOrders > 1 Then
Me.GroupFooter1.Visible = True 'want total
Else
Me.GroupFooter1.Visible = False 'no total
End If
End Sub

When I run the 2K mde file with Access 2K a report is printed but when I
run the same file with acess 2003 It looks busy for a brief time but no
report is printed & no errors are displayed.

The mdb file works with both versions.

THe report is opened with this command
DoCmd.OpenReport RptLocQuery, acPreview, , Pub_View_filter

Any idea why this happens?

Bob
 
S

SA

Bob:

You might try wrapping your code in the following:

If FormatCount=1 then
......Your code
End if
 
A

Allen Browne

1. Try putting the code into the Format event procedure of the section you
are formatting, i.e. GroupFooter1_Format().

2. Don't change the Visible property unless needed.

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
Dim bShow As Boolean

If FormatCount = 1 Then
bShow = (Me.NumberOrders > 1)

With Me.GroupFooter1
If .Visible <> bShow Then
.Visible = True 'want total
End If
End With
End If
End Sub


(Another approach would be to set the PrintSection and MoveLayout properties
of the Report rather than the Visible property of the section.)
 
B

Bob Hughes

Thanks but see below

1. Try putting the code into the Format event procedure of the section
you are formatting, i.e. GroupFooter1_Format().

This gave me the same results
2. Don't change the Visible property unless needed.

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As
Integer)
Dim bShow As Boolean

If FormatCount = 1 Then
bShow = (Me.NumberOrders > 1)

With Me.GroupFooter1
If .Visible <> bShow Then
.Visible = True 'want total
End If
End With
End If
End Sub

This does not work properly in 2K and gives me this in 2003

"Microsoft Office Access has encountered a problem and needs to close.
We are sorry for the inconvenience."
(Another approach would be to set the PrintSection and MoveLayout
properties of the Report rather than the Visible property of the
section.)

I do not understand what you mean.

If I convert to 2003 every thing works fine. But then I would have to run
2 different versions for a while.

Bob
 
A

Allen Browne

Okay, if Access is being shut down by Windows, there is a corruption in the
database. To fix it, try this sequence, using Access 2000:

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact

3. Close Access. Make a backup copy of the file. Decompile the database by
entering something like this at the command prompt while Access is not
running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

4. Open Access, and compact again.

5. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

6. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

At this point, you should have a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, and reference ambiguities are
resolved.

If it is still a problem, the next step would be to get Access to rebuild
the database for you. Follow the steps for the first symptom in this
article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html
 
B

Bob Hughes

Allen,

I was so convinced the problem was a 2k - 2003 difference that I was not
looking at the big picture.

Creating a new database & importing everything into it seems to have
corrected all my problems. It will take me a while to test everything, but
it is looking good so far.

Thank you so much for this advice. I now feel confident in doing my other
DB's. (Maybe I shouldn't say that)

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top