|
|
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
|
|
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? -- 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
"MK" wrote:
[Quoted Text] > 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 > >
|
|
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.
|
|
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 -- 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
"MK" wrote:
[Quoted Text] > 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.
|
|
On Thu, 4 Dec 2008 09:59:00 -0800, MK <MK[ at ]discussions.microsoft.com> wrote:
[Quoted Text] >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. --
John W. Vinson [MVP]
|
|
What about the syntax, Me.AllowAdditions = False john? I cant find that in the Me Options?
Regards -- 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
"John W. Vinson" wrote:
[Quoted Text] > On Thu, 4 Dec 2008 09:59:00 -0800, MK <MK[ at ]discussions.microsoft.com> wrote: > > >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. > -- > > John W. Vinson [MVP] >
|
|
"MikeJohnB" wrote:
[Quoted Text] > 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
|
|
"John W. Vinson" wrote:
[Quoted Text] > On Thu, 4 Dec 2008 09:59:00 -0800, MK <MK[ at ]discussions.microsoft.com> wrote:
> 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
|
|
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
"MK" wrote:
[Quoted Text] > > > "John W. Vinson" wrote: > > > On Thu, 4 Dec 2008 09:59:00 -0800, MK <MK[ at ]discussions.microsoft.com> wrote: > > > 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
|
|
yes, me too!! Merry Christmas!
"MikeJohnB" wrote:
[Quoted Text] > 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 > > > "MK" wrote: > > > > > > > "John W. Vinson" wrote: > > > > > On Thu, 4 Dec 2008 09:59:00 -0800, MK <MK[ at ]discussions.microsoft.com> wrote: > > > > > 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
|
|
|