Addnew Doesn't Addnew!

Addnew Doesn't Addnew!

Post by Camp10 » Sun, 12 Mar 2000 04:00:00



I have two forms with two data controls with sql recordsets on the same
table, one displays a dbgrid, the other data edit/entry for a single
record.  I can add new records in the first form and display and edit
them in the second form, but nothing will induce the second form to add,
even tho .addnew, .edit, and .update as well as save procedure produce
no errors.  Instead they simply overwrite the first of the records in
the recordset.  What's the matter - is this impossible?  If so, is there
a workaround?
 
 
 

1. First Recordset.AddNew Doesn't Appear in Grid

I'm using VB6 Enterprise.  I have a DataGrid Connected to an adodc that I'm
calling adcEvents, which is in turn connected to an Access 97 database table
called Events.  I'm just working with one table.

First I empty the table using

    Dim dbEvents as Database
    Set dbEvents = Workspaces(0).OpenDatabase("LeavTrak.mdb")
    dbEvents.Execute "DELETE * FROM Events"
    adcEvents.Refresh

which only sometimes results in the data being emptied from the grid.

Then I start adding data to the table using

    adcEvents.Recordset.AddNew
    adcEvents.Recordset!Code = txtEventCode.Text
    adcEvents.Recordset!Date = Calendar1.Value
    adcEvents.Recordset!Hours = txtHours.Text
    adcEvents.Recordset.Update
    adcEvents.Refresh

but, strangely, the first row added never shows in the grid.  Only starting
with the second AddNew does the data start appearing in the grid.  Why is
this?

2. Sybase FAQ: 13/13 - section 12

3. AddNew method doesn't work right!!

4. database connection problem ??

5. AddNew works, but then it doesn't (ADO)

6. load table from file with field header? (sql anywhere 5.5, WinNT)

7. Doesn't support AddNew Method

8. Big Table Maintenance

9. Addnew Doesn't Add New - It is being ignored

10. AddNew with ADO Recordset doesn't seem to work

11. Addnew works but doesn't...

12. AddNew on an empty Recordset fails in MS C++ AddNew Example

13. MultiUser Database DAO - 'Addnew'