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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The ADDNEW method not working

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
0
0
US
Hi VB people -

Using VB 6, I have a form which allows add/update/delete, with text boxes as data-bound controls via the ADO data control.

The problem is with Adding a new record :

*********************************************************
'The following code results in the new record getting written OVER the existing rec that was displayed before entering add mode. Also inserts an EMPTY row!
********************************************************

datPrimaryRS.Recordset.AddNew
datPrimaryRS.Recordset!ReaCode = txtCode
datPrimaryRS.Recordset!ReaDesc = txtDesc
datPrimaryRS.Recordset.Update

Thanks for any help. John

 
declare the recordset with these properties

.CursorType = adOpenKeyset
.LockType = adLockOptimistic
 
adOpenDynamic
adLockBatchOptimistic

and dont use the Update use UpdateBatch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top