Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write Conflict error when closing 1 form and opening another

Status
Not open for further replies.

Patentinv

Technical User
Aug 26, 2005
84
US
Hi,
I'm getting a (write conflict error) stating this record has been changed, asking me if I want to save this record, when I’m closing a form called labor and opening another form called primaryBid_Master.
If I click save, it saves it and every thing is OK.

Is there any way to stop access 2003 from giving this write conflict error message?

Here's more info.
I'm using access 2003, The record source for the Labor form is using a query called (laborqry) that has 1 table called primaryBid_Master, This is the same table that the PrimaryBid_Master form uses as its control source. The field
invoice # is the only field in the query, it has a criteria of [Forms]![PrimaryBid_Master]![Invoive#]
And I also have primaryBid_Master.* as a field so I can show all the customer information on my labor form just like the
PrimaryBid_Master form shows. Here is an example of both forms and the query.
 
Add the following code to the subform's button "onclick" event before the open form code.

DoCmd.RunCommand acCmdSaveRecord



This will save the record before opening the subform.
 
Hi LincolnMarkV,
The Popup forms command button has a macro, Can this code be placed in a macro? If not can you give an example code,
The Popup Forms name is LaborForm, PrimaryBid_Master Form is its source form.

Thanks--I appreciate your help.

 
Private Sub CmdName_Click()
On Error GoTo CmdName_Err

DoCmd.RunCommand acCmdSaveRecord

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "LaborForm"

stLinkCriteria = "[invoice#]=" & "'" & Me![invoice#] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

CmdName_Exit:
Exit Sub

CmdName_Err:
MsgBox Error$
Resume CmdName_Exit

End Sub
 
Hi LincolnMarkV,

Do I placed your code into the on click event procedure of the command button in the subform called LaborForm , hope this is correct?

I appoligize but I'm a beginner to database design espicially code.
Do I need to change any of the code so it will match my form names to make it work? If so please describe where.


Thanks-- for your help, I really appreciate it.
 
The code would be placed on the On Click Event on the command button on the main form. This will save the record and then open the subform.

Replace the command button's On Click macro with the code.
 
Hi, LincolnMarkV,
I did as you said and placed this code in the command button on the main form called PrimaryBid_Master, That opens the popup form called LaborForm.
I recieve an error that says the specified field [invoice#]
could refer to more than table listed in the from clause of the SQL statement

Just to clarify!
I recieve the write conflict error when I'm in the labor form and click its command button to return to the PrimaryBid_Master form.

Thanks--For your help
 
In your query, remove the PrimaryBidMaster.*

You need to actually place each individual field in the query.

[invoice#] is in the query twice because it is part of [primaryBidMaster.*] and [invoice#].

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top