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  

Frustrated - Error Messages Regarding Save



 
 
Thread Tools Display Modes
  #1  
Old October 31st, 2005, 11:42 PM
questionnaire database analyst
external usenet poster
 
Posts: n/a
Default Frustrated - Error Messages Regarding Save

I have a continuous form that pulls up all or some records. Then I can click
on a button beside each record to open up another form that brings up its
details.

The problems is that either 1) whenever I change something on the first
continuous form and open up the detailed form and start editing, or 2) I
close the detailed form after updating something and edit the same record on
the first continuous form, the following errors appear:

1) Write Conflict
2) Another user edited this record and saved the changes before you
attempted to save your changes. Re-edit the record.

I have tried adding a me.refresh command onto the close button of the
detailed form and the button that pulls up the detailed form. The error
messages disappeared but it’s very annoying sometimes that the form keep
refreshing!

I have read some comments on write-conflict and noticed that using me.dirty
might be a better way to fix this problem. However, I am not very good at
code. Could anyone help me out? Thanks * 100000


  #2  
Old November 1st, 2005, 06:19 AM
'69 Camaro
external usenet poster
 
Posts: n/a
Default Frustrated - Error Messages Regarding Save

I have read some comments on write-conflict and noticed that using me.dirty
might be a better way to fix this problem.


Then you've already investigated the problem and found the solution: save
the record _before_ you start editing it in another form.

However, I am not very good at
code.


Nearly all of the code needed is already written in your button's OnClick( )
event. You've got code that opens the Details form. Right? Try both of
these methods below and see which one you like better:

RunCommand acCmdSaveRecord
DoCmd.OpenForm "frmDetailsForm"

.. . . or:

Me.Dirty = True
DoCmd.OpenForm "frmDetailsForm"

.. . . where frmDetailsForm is the name of the Details form.

When returning from the Details form, save the record before closing that
form. This can be in the "Close" button's OnClick( ) event or in the form's
OnClose( ) event, but it's more reliable when placed in the form's OnClose( )
event, because users don't always use buttons to close forms. In the Details
form, try:

Private Sub Form_Close()

On Error GoTo ErrHandler

RunCommand acCmdSaveRecord

Exit Sub

ErrHandler:

MsgBox "Error in Form_Close( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
Err.Clear

End Sub

However, I am not very good at
code.


I think we can agree that the code above is a cake walk. And now you can
get rid of those annoying Me.Refresh commands.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


"questionnaire database analyst" wrote:

I have a continuous form that pulls up all or some records. Then I can click
on a button beside each record to open up another form that brings up its
details.

The problems is that either 1) whenever I change something on the first
continuous form and open up the detailed form and start editing, or 2) I
close the detailed form after updating something and edit the same record on
the first continuous form, the following errors appear:

1) Write Conflict
2) Another user edited this record and saved the changes before you
attempted to save your changes. Re-edit the record.

I have tried adding a me.refresh command onto the close button of the
detailed form and the button that pulls up the detailed form. The error
messages disappeared but it’s very annoying sometimes that the form keep
refreshing!

I have read some comments on write-conflict and noticed that using me.dirty
might be a better way to fix this problem. However, I am not very good at
code. Could anyone help me out? Thanks * 100000


  #3  
Old November 5th, 2005, 07:39 PM
questionnaire database analyst
external usenet poster
 
Posts: n/a
Default Frustrated - Error Messages Regarding Save

Thanks for replying

However, the message box still pops up whenever I change something on the
detailed form, close the detailed form, return back to the continuous form
with all the records (note that I do not have to open this form coz it is not
closed in the first place), and change something on the continuous form.

Another thing is that when I type the me.dirty command in the open button of
the continuous form, the following message pops up:
"Run-time error 7768": In order to change data through this form, the focus
must be a bound field that can be modified.


"'69 Camaro" wrote:

I have read some comments on write-conflict and noticed that using me.dirty
might be a better way to fix this problem.


Then you've already investigated the problem and found the solution: save
the record _before_ you start editing it in another form.

However, I am not very good at
code.


Nearly all of the code needed is already written in your button's OnClick( )
event. You've got code that opens the Details form. Right? Try both of
these methods below and see which one you like better:

RunCommand acCmdSaveRecord
DoCmd.OpenForm "frmDetailsForm"

. . . or:

Me.Dirty = True
DoCmd.OpenForm "frmDetailsForm"

. . . where frmDetailsForm is the name of the Details form.

When returning from the Details form, save the record before closing that
form. This can be in the "Close" button's OnClick( ) event or in the form's
OnClose( ) event, but it's more reliable when placed in the form's OnClose( )
event, because users don't always use buttons to close forms. In the Details
form, try:

Private Sub Form_Close()

On Error GoTo ErrHandler

RunCommand acCmdSaveRecord

Exit Sub

ErrHandler:

MsgBox "Error in Form_Close( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
Err.Clear

End Sub

However, I am not very good at
code.


I think we can agree that the code above is a cake walk. And now you can
get rid of those annoying Me.Refresh commands.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


"questionnaire database analyst" wrote:

I have a continuous form that pulls up all or some records. Then I can click
on a button beside each record to open up another form that brings up its
details.

The problems is that either 1) whenever I change something on the first
continuous form and open up the detailed form and start editing, or 2) I
close the detailed form after updating something and edit the same record on
the first continuous form, the following errors appear:

1) Write Conflict
2) Another user edited this record and saved the changes before you
attempted to save your changes. Re-edit the record.

I have tried adding a me.refresh command onto the close button of the
detailed form and the button that pulls up the detailed form. The error
messages disappeared but it’s very annoying sometimes that the form keep
refreshing!

I have read some comments on write-conflict and noticed that using me.dirty
might be a better way to fix this problem. However, I am not very good at
code. Could anyone help me out? Thanks * 100000


 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I save outlook e-mails as an e-mail, NOT a word document Rhian General Discussion 2 September 26th, 2005 07:05 PM
cannot edit and save jp General Discussion 0 February 8th, 2005 03:27 AM
Problems saving to offline folder JuanR Powerpoint 6 December 22nd, 2004 07:29 PM
2003 - new tasks will not save! Rock General Discussion 1 September 3rd, 2004 09:42 PM
Word.rtf file saves as Word .doc - using Save, not Save as... Grant Ord General Discussion 0 July 30th, 2004 03:31 PM


All times are GMT +1. The time now is 08:17 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.