error 2499

M

MK

hello. I've looked for an answer to this but can't find one.

I get error 2499 on my form when I click the "save" button and if the term
date field has been populated.

here is the code:

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

If Not IsNull(Me.Term_Date) And Me.Dirty Then
Call TermGroup
End If
DoCmd.GoToRecord , , acNext

Me.AllowAdditions = False
Me.AllowDeletions = False
Me.AllowEdits = False

Exit_cmdSave_Click:
Exit Sub

Err_cmdSave_Click:
If Err.Number = 3376 Then
Resume Next
Else
If Err.Number = 2499 Then
Resume next
Else
MsgBox "Error " & Err.Number & " - " &
Err.Description, , "cmdSave_Click"
Resume Exit_cmdSave_Click
End If
End If
End Sub

the function "TermGroup" does a few queries to other tables and I get no
errors on it.

I tried docmd.gotorecord, , acfirst -- but I want to go to the record I just
saved... how do I do that? and stop getting the error?

thank you so much!
MK
 
M

MikeJohnB

I,m not going to profess I know much about error 2499 but for the record you
just saved should it not be?

DoCmd.GoToRecord , , acLast

But I could be wrong?
 
M

MK

that works, but my record is still editable and it doesn't save the record. I
have to click Save again and it runs the same code again.
 
J

John W. Vinson

I tried docmd.gotorecord, , acfirst -- but I want to go to the record I just
saved... how do I do that? and stop getting the error?

There's nothing in your code as written that saves the record (other than the
gotorecord, , acnext) - which will certainly not return to the record you
saved!

To explicitly save the record - which might be required in your other
subroutine - you can insert a line

Me.Dirty = False

That will leave the cursor on the same record but will ensure that it has been
saved to disk.
 
M

MikeJohnB

You have a syntax error on Me.AllowEdits = False

You need something like
With frm
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With

Search Help
 
M

MikeJohnB

What about the syntax, Me.AllowAdditions = False john? I cant find that in
the Me Options?

Regards
 
M

MK

MikeJohnB said:
What about the syntax, Me.AllowAdditions = False john? I cant find that in
the Me Options?

That is to set the form back so the user cannot add records without pressing
a button... if anyone has a good example of this kind of form -where they
hard coded the buttons, please send me your email address and I'll write you
so you can forward it back to me? I also want a way to show how many
records are filtered when you do not use the default navigator buttons...
anyone have some code for that?

thanks!!
MK
 
M

MK

To explicitly save the record - which might be required in your other
subroutine - you can insert a line

Me.Dirty = False

That will leave the cursor on the same record but will ensure that it has been
saved to disk.

PERFECT!!! that did it! thanks! I don't have much experience in this kind
of thing.
thanks so much! have a nice Christmas.

MK
 
M

MikeJohnB

Sorry MK, have now found the Me.AllowEdits etc, was finger problem I think

Regards and Glad to know you have got to the bottom of it.

Cheers
 
M

MK

yes, me too!!
Merry Christmas!

MikeJohnB said:
Sorry MK, have now found the Me.AllowEdits etc, was finger problem I think

Regards and Glad to know you have got to the bottom of it.

Cheers
--
Advice to Posters.
Check your post for replies or request for more information.
Consider providing some feed back to the response you have recieved.
Kindest Regards Mike B
 

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

Similar Threads

Error Code 2046 1
Go To Specific Record after Requery 2
Saving a table to another file 3
Add New Record for Combo Box 5
Error Messages 1
Code help 8
Table Update ODBC 2
Saving records 3

Top