A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

save record button easier way?



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2008, 05:07 PM posted to microsoft.public.access.forms
Dean Hastas
external usenet poster
 
Posts: 1
Default save record button easier way?

Using Access 2003 Whats the easiest way to save a record after edit and
after insert behind a save commnad button. For example query1.posts ect

ect. Below is what the command button generates
but must be a cleaner way?
Thaks for any help

Private Sub Command59_Click()
On Error GoTo Err_Command59_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_Command59_Click:
Exit Sub

Err_Command59_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command59_Click

End Sub


  #2  
Old April 29th, 2008, 05:28 PM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default save record button easier way?

Well, that's only one line of code (not including the error handling) so
I'm not sure what you mean by a *cleaner* way. I suppose you could
replace it with;

Private Sub Command59_Click()
On Error GoTo Err_Command59_Click

DoCmd.RunCommand (acCmdSaveRecord)

Exit_Command59_Click:
Exit Sub

Err_Command59_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command59_Click

End Sub

BTW - you may want to consider giving your controls more meaningful names.
As time goes on and your db grows, having your code full of references like
Command59 and Text23, etc. will make it difficult to know what's what.

--
_________

Sean Bailey


"Dean Hastas" wrote:

Using Access 2003 Whats the easiest way to save a record after edit and
after insert behind a save commnad button. For example query1.posts ect

ect. Below is what the command button generates
but must be a cleaner way?
Thaks for any help

Private Sub Command59_Click()
On Error GoTo Err_Command59_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_Command59_Click:
Exit Sub

Err_Command59_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command59_Click

End Sub



  #3  
Old April 29th, 2008, 06:52 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default save record button easier way?

If Me.Dirty Then Me.Dirty = False

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Dean Hastas" wrote in message
news:xJ-dnSOijMd62orVnZ2dnUVZ_hqdnZ2d@dundkirkandfredoniat elephone...
Using Access 2003 Whats the easiest way to save a record after edit and
after insert behind a save commnad button. For example query1.posts ect

ect. Below is what the command button generates
but must be a cleaner way?
Thaks for any help

Private Sub Command59_Click()
On Error GoTo Err_Command59_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_Command59_Click:
Exit Sub

Err_Command59_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command59_Click

End Sub




  #4  
Old April 29th, 2008, 07:13 PM posted to microsoft.public.access.forms
Clif McIrvin[_2_]
external usenet poster
 
Posts: 629
Default save record button easier way?

"Douglas J. Steele" wrote in message
...
If Me.Dirty Then Me.Dirty = False



Is that documented somewhere? It doesn't seem to be in the installed
help files for Access 2003.

--
Clif
Still learning Access 2003




--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Dean Hastas" wrote in message
news:xJ-dnSOijMd62orVnZ2dnUVZ_hqdnZ2d@dundkirkandfredoniat elephone...
Using Access 2003 Whats the easiest way to save a record after edit
and after insert behind a save commnad button. For example
query1.posts ect

ect. Below is what the command button generates
but must be a cleaner way?
Thaks for any help

Private Sub Command59_Click()
On Error GoTo Err_Command59_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70

Exit_Command59_Click:
Exit Sub

Err_Command59_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command59_Click

End Sub






  #5  
Old April 29th, 2008, 07:55 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default save record button easier way?

http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx

Unfortunately, while it points out that the Dirty property is updatable, it
fails to mention that setting it to False saves the record.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Clif McIrvin" wrote in message
...
"Douglas J. Steele" wrote in message
...
If Me.Dirty Then Me.Dirty = False



Is that documented somewhere? It doesn't seem to be in the installed help
files for Access 2003.

--
Clif
Still learning Access 2003




--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Dean Hastas" wrote in message
news:xJ-dnSOijMd62orVnZ2dnUVZ_hqdnZ2d@dundkirkandfredoniat elephone...
Using Access 2003 Whats the easiest way to save a record after edit and
after insert behind a save commnad button. For example query1.posts ect

ect. Below is what the command button generates
but must be a cleaner way?
Thaks for any help

Private Sub Command59_Click()
On Error GoTo Err_Command59_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70

Exit_Command59_Click:
Exit Sub

Err_Command59_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command59_Click

End Sub








  #6  
Old April 29th, 2008, 10:55 PM posted to microsoft.public.access.forms
Clif McIrvin[_2_]
external usenet poster
 
Posts: 629
Default save record button easier way?

"Douglas J. Steele" wrote in message
...
http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx

Unfortunately, while it points out that the Dirty property is
updatable, it fails to mention that setting it to False saves the
record.



Thanks, Doug! A quick scan of that page looks just like my installed
help file. That serves as a reminder to come back here and verify what
the official documentation says, doesn't it?
--
Clif
Still learning Access 2003





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.