By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,847 Members | 2,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,847 IT Pros & Developers. It's quick & easy.

Run-time error '2499'

P: n/a
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 appreciated
Aug 13 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Aug 13, 3:48*pm, dee <promotions.market...@comcast.netwrote:
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, "Takingyou
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 appreciated
Where does the code with the GoToRecord in it run? In the Load event
of fmLeads? Also what is TypeTransfer? Is that a field on fmLeads or
a function? Finally, what code are you using to actually open
fmLeads?

Bruce
Aug 14 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.