S
SFAxess
Hello,
I have been developing an ADP in Access 2000. Midway
through development, I upgraded to Access 2002, but kept
the file format Access 2000 since all client machines
have Access 2000. After working on the application for a
month on Access 2002 (in 2000 file format), I just moved
it over to a machine with Access 2000 and am getting
strange errors that never existed before and don't come
up when I run it in Access 2002.
Specifically, I get a (2465) stating that Access can't
find the field 'Forms' referred to in the expression.
This occurs when using record navigation code which I
have used countless times. See code below:
This is based on code from Access 97 Developer's Handbook
by Litwin, Getz, and Gilbert (Sybex)
Copyright 1997. All rights reserved.
Private Sub NavMove(frm As Form, intWhere As Integer)
'
' Move to the correct row in the form's recordset,
' depending on which button was pushed. This code
doesn't
' really need to check for errors, since the buttons
' that would cause errors have been disabled already.
'
Dim rst As ADODB.Recordset
Dim fAtNew As Boolean
Set rst = New ADODB.Recordset
Const adhcErrNoCurrentRow = 3021
If frm.Dirty Then
' Put code here that you would have done in the
' form's AfterUpdate event. You can't use the
AfterUpdate
' event if you've got these buttons in place,
since
' they interfere pretty seriously.
End If
On Error GoTo NavMoveError
' This only works on the CURRENT form.
' You'll need to rethink this if you want
' the buttons on one form, and the record
' movement on another.
If intWhere = acNewRec Then
DoCmd.GoToRecord record:=acNewRec
Else
fAtNew = frm.NewRecord
Set rst = frm.RecordsetClone
rst.Bookmark = frm.Bookmark
Select Case intWhere
Case acFirst
rst.MoveFirst
Case acPrevious
If fAtNew Then
rst.MoveLast
Else
rst.MovePrevious
End If
Case acNext
rst.MoveNext
Case acLast
rst.MoveLast
End Select
frm.Bookmark = rst.Bookmark
End If
NavMoveExit:
Exit Sub
NavMoveError:
If Err.Number = adhcErrNoCurrentRow And frm.NewRecord
Then
Resume Next
Else
MsgBox Err.Description & " (" & Err.Number & ")"
Resume NavMoveExit
End If
Resume NavMoveExit
End Sub
The only thing I can think of is the reference to
the "Microsoft Forms 2.0 Object Library" which is in the
project, but does not normally exist in the Access 2000
reference list.
Does anyone know of a glitch with using Access 2000 file
format while developing in Access 2002?
Thank you so much in advance
I have been developing an ADP in Access 2000. Midway
through development, I upgraded to Access 2002, but kept
the file format Access 2000 since all client machines
have Access 2000. After working on the application for a
month on Access 2002 (in 2000 file format), I just moved
it over to a machine with Access 2000 and am getting
strange errors that never existed before and don't come
up when I run it in Access 2002.
Specifically, I get a (2465) stating that Access can't
find the field 'Forms' referred to in the expression.
This occurs when using record navigation code which I
have used countless times. See code below:
This is based on code from Access 97 Developer's Handbook
by Litwin, Getz, and Gilbert (Sybex)
Copyright 1997. All rights reserved.
Private Sub NavMove(frm As Form, intWhere As Integer)
'
' Move to the correct row in the form's recordset,
' depending on which button was pushed. This code
doesn't
' really need to check for errors, since the buttons
' that would cause errors have been disabled already.
'
Dim rst As ADODB.Recordset
Dim fAtNew As Boolean
Set rst = New ADODB.Recordset
Const adhcErrNoCurrentRow = 3021
If frm.Dirty Then
' Put code here that you would have done in the
' form's AfterUpdate event. You can't use the
AfterUpdate
' event if you've got these buttons in place,
since
' they interfere pretty seriously.
End If
On Error GoTo NavMoveError
' This only works on the CURRENT form.
' You'll need to rethink this if you want
' the buttons on one form, and the record
' movement on another.
If intWhere = acNewRec Then
DoCmd.GoToRecord record:=acNewRec
Else
fAtNew = frm.NewRecord
Set rst = frm.RecordsetClone
rst.Bookmark = frm.Bookmark
Select Case intWhere
Case acFirst
rst.MoveFirst
Case acPrevious
If fAtNew Then
rst.MoveLast
Else
rst.MovePrevious
End If
Case acNext
rst.MoveNext
Case acLast
rst.MoveLast
End Select
frm.Bookmark = rst.Bookmark
End If
NavMoveExit:
Exit Sub
NavMoveError:
If Err.Number = adhcErrNoCurrentRow And frm.NewRecord
Then
Resume Next
Else
MsgBox Err.Description & " (" & Err.Number & ")"
Resume NavMoveExit
End If
Resume NavMoveExit
End Sub
The only thing I can think of is the reference to
the "Microsoft Forms 2.0 Object Library" which is in the
project, but does not normally exist in the Access 2000
reference list.
Does anyone know of a glitch with using Access 2000 file
format while developing in Access 2002?
Thank you so much in advance