Hi VB experts -
I posted in the VB 5/6 forum but no one responded, so I'll
ask the pros...
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 Update and Delete methods work fine.
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!
********************************************************
I am using Textboxes that are automatically bound to the
Recordset fields.
-There is an existing record displayed in the 2 Textboxes
-When the AddRecord button is clicked, I clear the Textboxes
txtCode.Text = ""
txtDesc.Text = ""
-User enters info into the Textboxes
-User clicks another button which does the following...
datPrimaryRS.Recordset.AddNew
datPrimaryRS.Recordset!ReaCode = txtCode.Text
datPrimaryRS.Recordset!ReaDesc = txtDesc.Text
datPrimaryRS.Recordset.Update
The above code causes the previous "current" record to be
destroyed by overlaying it with the newly entered info.
Isn't there a way I can use the data-bound controls, yet not lose a record when an Add is performed ?
Thanks for any help. John
I posted in the VB 5/6 forum but no one responded, so I'll
ask the pros...
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 Update and Delete methods work fine.
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!
********************************************************
I am using Textboxes that are automatically bound to the
Recordset fields.
-There is an existing record displayed in the 2 Textboxes
-When the AddRecord button is clicked, I clear the Textboxes
txtCode.Text = ""
txtDesc.Text = ""
-User enters info into the Textboxes
-User clicks another button which does the following...
datPrimaryRS.Recordset.AddNew
datPrimaryRS.Recordset!ReaCode = txtCode.Text
datPrimaryRS.Recordset!ReaDesc = txtDesc.Text
datPrimaryRS.Recordset.Update
The above code causes the previous "current" record to be
destroyed by overlaying it with the newly entered info.
Isn't there a way I can use the data-bound controls, yet not lose a record when an Add is performed ?
Thanks for any help. John