Run-time error '2499'

D

dee

I have a form 'FmMessages" and a form 'FmLeads'.
'FmMessages', through code, opens 'FmMessages" if it is not already
open.
It then sets focus on 'FmLeads' and runs the following code:

Dim rst As Object
Dim Tid As Long
If typetransfer = "Valid Number" Or typetransfer = "New Number" Then
DoCmd.GoToRecord , , acNewRec
Me.ID = Forms![FmMessages].testCode
Set rst = Me.Recordset.Clone
Tid = Me.ID

If Not IsNull(DLookup("ID", "Contacts", "ID = " & Tid)) Then
MsgBox "ID Number Already Exists", vbExclamation, "Taking you
to that record"
Me.Undo
rst.FindFirst "ID = " & Tid
Me.Bookmark = rst.Bookmark
End If
....more code here
End if

All of this runs just fine if 'FmLeads' was closed and then opened by
code in 'FmMessages'.

My problem comes when the 'FmLeads' form is already open. The line:
DoCmd.GoToRecord , , acNewRec
now produces the following error:

Run-time error '2499'
"You can't use GoToRecord a"ction or method on an object in Design
view"

Needles to say, form 'FmLeads' is not open in design view, and it does
have focus.

Your help would be very much appreciate
 

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