Unexplained run-time error 3021

G

Guest

Hello

In an application I had used in all the forms the code
…
err_Form_Current:
If Err = 3021 Then
Resume Next
Else …
to suppress the ‘no current record’ error messages when navigating through
empty record subform using my custom made navigation buttons.
But now all suddenly when I navigate through a form with empty record
subform I get the message “Run-time error 3021 no current recordâ€
I have copied and run the same application in another computer and for the
same cases I get no error messages.
Can you give please any explanation to that?

Thank you
GL
 
G

Guest

GL,

Does the procedure in which this code appears have the statement

On Error Goto err_Form_Current

at the top?

Sprinks
 
G

Guest

I list below the whole code for the on current event of the form

Private Sub Form_Current()
On Error GoTo err_Form_Current

Dim rs As DAO.Recordset
Dim Count As Integer, Position As Integer

Set rs = Me.RecordsetClone
rs.MoveLast
rs.MoveFirst

Count = rs.RecordCount
Me!txtRecCnt = "of " & Count

Position = Me.CurrentRecord
Me!txtRecPos = Position


If Position = 1 Then
Me!gotoPrevious.Enabled = False
Else
Me!gotoPrevious.Enabled = True
End If

If Position > Count Then
Me!gotoNext.Enabled = False
Me!gotoNew.Enabled = False
Me!txtRecCnt = "of " & Position
Else
Me!gotoNext.Enabled = True
Me!gotoNew.Enabled = True
Me!txtRecCnt = "of " & Count
End If

rs.Close

Exit_Form_Current:
Exit Sub

err_Form_Current:
If Err = 3021 Then ' no current record
Resume Next
Else
MsgBox Err.Description
Resume Exit_Form_Current
End If

End Sub

In the meantime I made an investigation and I have found that the problem
has arised after I have downloaded and run an application from the site
www.databasejournal.com/img/ExportToExcel.zip
For a strange reason the same problem happens in any computer after I run
the downloaded application.
 
G

Guest

GL,

It sounds like this application is changing a setting in the Registry; on a
virgin computer, it might be useful to look at the Registry before and after
running this program.

Other than that, although Number is the default property for the Err object,
it's possible that the application is forcing the reference to be explicit,
so I'd also try changing

If Err = 3021
to
If Err.Number = 3021

Good luck.
Sprinks
 

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