Results 1 to 3 of 3

Thread: How to add a record to an empty table?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    17
    I'm working with ado and now that I have the table created, how do I add a record to an empty table? I want to use ado and a flexgrid, but every time I do an add I get an error.

    Another question I have is when I'm deleting records from a table and delete the last record I get an error message and at that point I am stuck. What am I suppose to do in this situation?

    Help on any of the two questions would be nice, thanx.

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    To add a new record into a table you can use the INSERT statment like...

    INSERT INTO <Table Name>(<Field Name1>,<Field Name2>,..<Field Namen>) Value(<Value 4 Field1>,<Value 4 Field2>,...<Value 4 Fieldn>)

    or you also can open a reocrdset and use the AddNew & Update.

    Hope this can help.

  3. #3
    New Member
    Join Date
    Mar 2000
    Posts
    12
    What is the error message that you're getting when you've deleted the last record?

    It could be that if you're in a loop to read one record at a time, once you've deleted the last record on move to the next record, you're at the end of file (.EOF) and there's nothing to read/delete. Maybe you should try counting the number of records in the table first, then set your counter to go through that number of records only. Or, you could delete records until .EOF is true.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width