help with record update 
Author Message
 help with record update

I am writing a function to make tables out of the table names and field
properties in my companies product.  The problem is that for some reason
when I add the first record to the "writert" recordset and update it, it
doesn't recognize that there is a record there and generates an error "no
current record"  when it reaches the line numbered 100.  If there are
already entries in the table no error occurs.  Why isn't it recognizing the
record that was added and how do I fix it?

I would really appreciate any help or suggestions
thanks,
steve moyer

Function CycleThruTable()

Dim db As Database
Dim tdf As TableDef
Dim writert As Recordset
Dim writerf As Recordset
Dim readerf As Field
Dim idnum As Long
Dim counter As Integer
Dim rbookmark As Variant

Dim tbl As Recordset

    Set db = CurrentDb

    'this is the table of tables
    Set writert = db.OpenRecordset("atablenamesfe")

    'this is the table of table fields
    Set writerf = db.OpenRecordset("afieldtablefe")
    counter = 0

  'for all tables excluding system tables
    For Each tdf In db.TableDefs
        If (tdf.Name > "T0") Then
        If (tdf.Name < "TZ") Then

            'add a new entry
            writert.AddNew

            'set table name
            writert!TableName = tdf.Name

            'insert it into the table
            writert.Update

        'for each field in the selected table
       For Each readerf In tdf.Fields

               'create new record

               writerf.AddNew

                ' write all the properties in the table
                writerf!FieldName = readerf.Name
100                writerf!tableid = writert!tableid
                writerf!FieldType = readerf.Type
                writerf!fieldlength = readerf.Size
                writerf!Required = readerf.Required

                 ' insert record into table
                writerf.Update
            Next

        End If
        End If

    Next

        Stop
  End Function



Sat, 03 Nov 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. HELP...Confirm record update.

2. Help on Updating Records: PLEASE HELP

3. RE Help on Updating Records: PLEASE HELP

4. Updating a single OLE link for a record OR updating existing database

5. VB6,Access97,ADO - Update query doesn't update all records

6. UPDATE query not updating records

7. Lost updated record after Update!

8. Recordsets Finding Records and Updating Records

9. Finding Records and Updating Records in More than one Recordsets

10. Update a record using a previous records value

11. help with using dao to update a record when printed

12. Help updating multiple records!

 

 
Powered by phpBB® Forum Software