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  

Applying changes to record



 
 
Thread Tools Display Modes
  #1  
Old January 15th, 2010, 03:08 PM posted to microsoft.public.access.forms
Colorado
external usenet poster
 
Posts: 7
Default Applying changes to record

Is there any way in Access 2003 to apply any edits to a record or entry of a
new record only when a user clicks on a button? Like when you edit a
document, changes aren't applied to the document file unless you click save
or save as.
  #2  
Old January 15th, 2010, 03:22 PM posted to microsoft.public.access.forms
ghetto_banjo
external usenet poster
 
Posts: 325
Default Applying changes to record

i usually get around this by turning off the Close X button in the
form properties, and the making my own button for Cancel/Close that
uses the Undo Record change command. that way they are forced to
either click save, or click cancel and are not able to simply close
the form by clicking the X.
  #3  
Old January 15th, 2010, 03:35 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default Applying changes to record

You could use the form's Current event to set the value of an unbound (hidden)
text box to a value such as 1. In the Click event of the button, set the
text box value to 2. In the form's Before Update event, check the text box
value before saving the record:

Private Sub Form_Current()

Me.txtCheck = 1

End Sub

Private Sub cmdSave_Click()

Me.txtCheck = 2
Me.Dirty = False ' This saves the record

End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.txtCheck = 1 Then
MsgBox "You didn't click the Save button. Changes won't be saved."
Me.Undo
End If

Exit Sub

I wonder why you would want to do it this way, unless there is a need for
something to happen each time the record is changed (print a report, send an
e-mail, or whatever). You may want to give the users a chance to go back and
click the required button rather than simply notifying them that the changes
will be discarded:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.txtCheck = 1 Then
If MsgBox ("Click the button to save the record", vbOkCancel) = vbOK Then
Cancel = True
Me.CommandButtonName.SetFocus
Else
Me.Undo
End If
End If

Exit Sub

Use whatever error message you like, and use vbYesNo (or something else)
instead of vbOKCancel if it makes more sense.

Colorado wrote:
Is there any way in Access 2003 to apply any edits to a record or entry of a
new record only when a user clicks on a button? Like when you edit a
document, changes aren't applied to the document file unless you click save
or save as.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #4  
Old January 15th, 2010, 03:37 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default Applying changes to record

What if they navigate to another record?

ghetto_banjo wrote:
i usually get around this by turning off the Close X button in the
form properties, and the making my own button for Cancel/Close that
uses the Undo Record change command. that way they are forced to
either click save, or click cancel and are not able to simply close
the form by clicking the X.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #5  
Old January 15th, 2010, 03:43 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Applying changes to record

Colorado -

You can put code in the 'BeforeUpdate' event. You can create a form
variable to track whether the button has been clicked or not. This would
normally be a hidden unbound variable. The value should be set to False
whenever the form is opened or a record changed. You set it True only when
the button is clicked.

Then in the BeforeUpdate event, if this variable is false, you set 'Cancel'
to true. Otherwise you set the new variable back to false and the Save will
happen.

That is one high-level approach. Check it out.

--
Daryl S


"Colorado" wrote:

Is there any way in Access 2003 to apply any edits to a record or entry of a
new record only when a user clicks on a button? Like when you edit a
document, changes aren't applied to the document file unless you click save
or save as.

  #6  
Old January 15th, 2010, 03:44 PM posted to microsoft.public.access.forms
ghetto_banjo
external usenet poster
 
Posts: 325
Default Applying changes to record

i don't allow that either :-)

i found a function that disables the mouse wheel in access while the
form is open. works well in this particular database as the user
doesnt really need to cycle through multiple records.
  #7  
Old January 15th, 2010, 05:33 PM posted to microsoft.public.access.forms
Tom Lake[_2_]
external usenet poster
 
Posts: 96
Default Applying changes to record


"ghetto_banjo" wrote in message
...
i don't allow that either :-)


Not even allowing them to go to another line in a subform?

Tom Lake

 




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 01:35 PM.


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