Custom Nav Buttons fail in 2003

A

Al Camp

Folks,
I realize this will be a tough question to answer, but I thought I'd give
it a go... perhaps someone has run into this problem.

I use an old Ken Getz Access 2.0 custom Navigation Buttons routine that
I've used through the years with 95/98/2000.
When I use that code in 2003, record to record navigation works fine,
but... going to a New record causes a "No Current Record" error.
The buttons and code were Cut & Pasted ...

If I place the "Access" default nav buttons on the form... they work just
fine.
Both the Main and Subform queries/recordsets are updateable, and linked
One to Many on a Long field.
All "Allows" are Yes.
It appears as though 2003 is having a problem with the old code.

***The form's OnCurrent runs this external module code...
Sub ahtHandleCurrent(frm As Form)
Dim rst As Recordset
Dim fAtNew As Integer
Dim fUpdateable As Integer
Set rst = frm.RecordsetClone
fAtNew = AtNewRecord(frm)
fUpdateable = rst.Updatable And (frm.DefaultEditing <= 2)
frm!cmdNew.Enabled = IIf(fUpdateable, Not fAtNew, False)
' the remaining code just enables disables the buttons....

***This is where the code fails...
Private Function AtNewRecord(frm As Form)
Dim strBM As String
Const NO_CURRENT_ROW = 3021
On Error Resume Next
strBM = frm.Bookmark ' *** Fails...frm.BookMark = No Current Record
AtNewRecord = (Err = NO_CURRENT_ROW)
On Error GoTo 0
End Function

Thanks for any assistance...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
B

Brendan Reynolds

The AtNewRecord function is not needed in any version later than Access 2,
as in all later versions forms have a built-in NewRecord property, so if the
problem is in that function, why not just get rid of it? Or, to minimize
changes to existing code, modify it like so ...

Private Function AtNewRecord(frm As Form)
AtNewRecord = frm.NewRecord
'Dim strBM As String
'Const NO_CURRENT_ROW = 3021
'On Error Resume Next
'strBM = frm.Bookmark ' *** Fails...frm.BookMark = No Current Record
'AtNewRecord = (Err = NO_CURRENT_ROW)
'On Error GoTo 0
End Function
 

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