Another question for the experts!! 
Author Message
 Another question for the experts!!

I have data stored in my customer table that I would like to autopopulate
once a customer has been selected.

My problem is that this is a multiuser database, so I really need to lock
edited records.  So, I get the error that the record is locked when I try to
update the fields in code.  If I unlock the record (which I don't want to
do) I still get the message that this record has been modified and gives me
the 3 options.

Can anyone tell me how to copy this data over to my current record without
these errors/warnings coming up?

Thank you

Jerry



Sun, 09 Feb 2003 03:00:00 GMT  
 Another question for the experts!!

Jerry:

My guess is that how you are doing this now, is that on your form you create
a new record, use your combo to enter a customer into a live field, and then
launch code to add the other data.   The error you are receiving is due to
the fact that you have two edits going on the same record at the same time;
once in the form and once in code.

To resolve this, set the control source for your combo where the customer is
selected to be unbound (i.e. don't link it to the live customer field.)   In
the after update event of the combo, launch a recordset clone and use that
to addnew.   After you update the recordset clone, move the that record
using the last modified property of the recordset, last, set your form to
move to that recordset using the bookmarkk property.  Here's sample code:

Set rstTemp = Me.RecordsetClone
With rstTemp
  .AddNew
  !CustomerID = Me!cboCustID
  !FirstName = strFirst
  !LastName = strLast
  .Update
  .Bookmark = .LastModified  'Move to the record you just added.
  Me.Bookmark = .Bookmark  'Synch the form to the record in the clone
 End With

Set rstTemp = Nothing

HTH
--
Steve Arbaugh
ATTAC Consulting Group
http://ourworld.compuserve.com/homepages/attac-cg/acgsoft.htm


Quote:

> I have data stored in my customer table that I would like to autopopulate
> once a customer has been selected.

> My problem is that this is a multiuser database, so I really need to lock
> edited records.  So, I get the error that the record is locked when I try
to
> update the fields in code.  If I unlock the record (which I don't want to
> do) I still get the message that this record has been modified and gives
me
> the 3 options.

> Can anyone tell me how to copy this data over to my current record without
> these errors/warnings coming up?



Mon, 10 Feb 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. question for an expert?

2. A question only for expert!!!

3. A question only for expert!

4. A QUESTION ONLY FOR EXPERT

5. VB questions for the Experts: Complete NULL record.....

6. 2 Questions For The Experts

7. QueSTioN FoR THe eXPeRTs : can this be done???

8. 2 Questions For The Experts

9. Question for the experts (ActiveX DLL's without references)

10. Easy question for the experts

11. VB questions for the Experts: Complete NULL record.....

12. Questions for VB4 Experts: Fake MDI

 

 
Powered by phpBB® Forum Software