PDA

Click to See Complete Forum and Search --> : How to add a record to an empty table?


daamazing1
Mar 21st, 2000, 11:08 AM
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.

Chris
Mar 21st, 2000, 01:40 PM
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.

hkmai
Apr 4th, 2000, 03:42 AM
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.