Access 2002 MAR not opening in 2003

K

KGF

I have some reports that were created in Access 2002. We now have several
2003 users and they are complaining that they can't open these reports. An
error pops up that eventually seems to incriminate the code below as not
being valid in Access 2003. Just wondering if anybody might spot a problem
with this code, or have other suggestions on how to fix this.

Option Compare Database

Private Sub Command9_Click()
On Error GoTo Err_Command9_Click

Dim stDocName As String

stDocName = "Find blanks and by Dept"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command9_Click:
Exit Sub

Err_Command9_Click:
MsgBox Err.Description
Resume Exit_Command9_Click

End Sub
Private Sub Find_by_Extension_Click()
On Error GoTo Err_Find_by_Extension_Click

Dim stDocName As String

stDocName = "Find by Extension"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Find_by_Extension_Click:
Exit Sub

Err_Find_by_Extension_Click:
MsgBox Err.Description
Resume Exit_Find_by_Extension_Click

End Sub
 
M

Mike Painter

You say reports but thes open up queries. Do those queries exist?

I see nothing wrong with the code, but just to make sure, there are two
routines listed, probably assoicated with a two buttons on form(s).
Are there any others that don't have this problem?
 
K

KGF

Forget that, after doing some more debugging I found the offensive code.
when I REM it out the report works fine. Something here that 2003 doesn't
like: Anybody have an idea on how to fix this?

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Const WHITE = 16777215
'Const YELLOW = 65535

If (Me![LineNum] Mod 2) = 0 Then
Me![Name].BackColor = RGB(230, 230, 230)
Me![Ext].BackColor = RGB(230, 230, 230)
Else
Me![Name].BackColor = WHITE
Me![Ext].BackColor = WHITE
End If
End Sub
 
K

KGF

Mike thank you, but I found the problem, The second set of code I Posted was
gotten from the internet, and it makes alternating colored lines on the
report. When I eliminated the constant for WHITE and with RGB code instead,
it started working fine. 2003 doesn't like something about the way that code
was originally written.
 
D

Dirk Goldgar

KGF said:
Forget that, after doing some more debugging I found the offensive code.
when I REM it out the report works fine. Something here that 2003 doesn't
like: Anybody have an idea on how to fix this?

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Const WHITE = 16777215
'Const YELLOW = 65535

If (Me![LineNum] Mod 2) = 0 Then
Me![Name].BackColor = RGB(230, 230, 230)
Me![Ext].BackColor = RGB(230, 230, 230)
Else
Me![Name].BackColor = WHITE
Me![Ext].BackColor = WHITE
End If
End Sub

It isn't clear to me whether it's the WHITE constant that was giving you
trouble or the YELLOW constant (commented out). I note that RGB(230, 230,
230) is not yellow. Does it work if you substitute the predefined VB
constant for white and yellow:

'----- start of code -----
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If (Me![LineNum] Mod 2) = 0 Then
Me![Name].BackColor = vbYellow
Me![Ext].BackColor = vbYellow
Else
Me![Name].BackColor = vbWhite
Me![Ext].BackColor = vbWhite
End If

End Sub
'----- end of code -----

If you wanted the RGB(230,...) value instead of yellow, and it was the WHITE
constant that was a problem, does this work:

'----- start of code -----
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If (Me![LineNum] Mod 2) = 0 Then
Me![Name].BackColor = RGB(230, 230, 230)
Me![Ext].BackColor = RGB(230, 230, 230)
Else
Me![Name].BackColor = vbWhite
Me![Ext].BackColor = vbWhite
End If

End Sub
'----- end of code -----

?
 

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