Write Conflict Error :(

NewShoes

Registered User.
Local time
Today, 05:05
Joined
Aug 1, 2009
Messages
223
Hey all,

Hoping someone can help on this..

I have form with a subform and the subform is linked to a combo box on the main form. Within the subform I have a little button next to each record that, when clicked, a pop up window appears and allows the user to enter a note against each record.

Now comes the issue - sometimes if I enter a note, close the little pop up window and click back into the record on the subform, I get a write conflict error and I'm asked if I want to discard or save the changes. I believe this may be because I am effectively opening up 2 instances of the same record.

ANy ideas or solutions for this?

Many thanks,
-NS
 
Make the pop-up form unbound and send the entered value back to the subform on the main form using the AfterUpdate event of the textbox (on the pop-up form).

After Update event:
Code:
Forms![COLOR=Red]MainFormName[/COLOR]![COLOR=Red]SubformName[/COLOR]![COLOR=Red]Textbox[/COLOR]
where textbox is the name of the textbox on the subform which is linked to the field.
 
Thanks for the reply vbaInet.

I'm a little unsure of how to go about this. I'm dont have a 'note' textbox on the subform, I have a button that opens the popup form that contains the 'notes' text box.

In what After Update event do I put that code in? The text box on the popup form?

Thanks,
-NS
 
Yes the After Update event of the textbox in the pop-up form.

You have a Notes field in the subform. Refer to the Notes field in the subform.
 
Thanks, I will try this. Just one question, if I go back to the record, click the button to open the Notes popup form, will the notes I have previosuly entered be visable?

Thanks,
-NS
 
As long as you saved the record by moving to another record or doing it in code.
 
I'm a little confused, I think I may have given the wrong impression. I not have a Notes textbox in the subform. Instead of a Notes textbox I have a little button. When this button is clicked, it opens up a popup form using a WHERE condition and links the Notes field in the popup form to the row ID in the subform. I can then enter/delete/whatever the Notes in the popup form.

Does this make any sense?

Thanks,
-NS
 
So the subform's record source doesn't have a notes FIELD?
 
Ah yes, the recordsource does, is that what you were refering to?

If so.....If I use an unbound textbox in the popup form and then put the code in the After Update event, how will the Note be there if I close it an open it back up again 5mins later? Surely I'd need to use an event to pull through the Notes when the popup is opened?

Sorry for the questions, just finding this confusing!

-NS
 
If the Notes field is called Notes, you put this in the After Update event of the textbox in the pop-up form:
Code:
Forms!FormName!SubFormName!Notes
Does that make sense? So anything you change anything in the unbound pop-up form's textbox, it will send the value to the notes FIELD in the subform.
 
Thanks, I think I'm just going to have to give this a go and see what happens. I the bit I am struggling with is...

I open my database, locate a record, enter a note in the popup form, after update event kicks in and puts the text in the notes field and I carry on using as normal then close the database when finished. I then decide, 1 hr later, to open the database and enter more records. I go back to the original record and want to see the notes so I click the notes button and open the popup form. Now, because text bix is unbound and I haven't changed anything, the After Update event wont activate and the text box will be blank?

Thanks,
-NS
 
In the Load event of the pop-up form, just send the value of the Notes field to the textbox.

As you can see, it's just a reverse process.
 
Ok Great, I can see how that will work. However, now the popup form is unbound, I have the problem of linking the Notes field to the subform record of which I'm entring notes for. :o/

Can I ask, should the whole popup FORM be undound, or just the Notes textbox?

Thanks,
-NS
 
You mentioned in post #9 that the subform's Record Source has the Notes field present. I don't see why you're having problems.

Yes - form unbound and obviously textbox will automatically be unbound.
 
I'm having a problem because the subform has multiple records and therefore mutliple buttons. When I click any of those buttons, I need to somehow tell the popup form that "this note is for record with the ID 211". I'm having trouble seeing how to do that when the popup form is unbound. Perhaps i'm going about this wrongly?
 
You don't have to worry about that. It knows what ID it came from. The cursor remains in the row it was last on when it opens the pop-up form.

So just make sure your pop-up form is Modal so that the user cannot do anything else unless he/she closes the form.
 
Right, just tried this and I get a compile error ("expecting a =") when I enter the After Update/Load Form codes. Any idea?
 
Forms!MainFormName!SubformName!Textbox

Obviously changed for my form names etc.
 
I want to see the exact names as you've written it. And the full code.
 

Users who are viewing this thread

Back
Top Bottom