1. How can I clear a recordset, Deleting all fields from the recordset?
2. How can i check if a field is exist?
Tnx
Printable View
1. How can I clear a recordset, Deleting all fields from the recordset?
2. How can i check if a field is exist?
Tnx
are you wanting to delete the values contained in the fields?
or delete the fields from the tables?
what database system are you using?
are you doing this in VB, C++, ASP?
i'm using VB and Access
I want to delete Values.
What about the second question? :)
1) Execute the following sql
Delete * from tablename
2)
Open a recordset with
Select * from Tablename
Using error handling (on error resume next) and use the following lines of vbcode:
Tablename is the name of the tableVB Code:
Dim strTester as string on error resume next strtester=rst("fieldname").name if err.number = 0 then 'field exists else err.clear 'field doesn't exist endif
fieldname is the fieldname
Code above assuems rst is the recordset (put the dim in the first few lines and the rest of the code where you need it)
Vince
I don't think you need the * in the DELETE statement...