Click to See Complete Forum and Search --> : Update several records at the same time
Blue Sky
April 2nd, 2001, 11:52 PM
I need to update several records at the same time.
I used
for i = 0 to 3
rs("name") = UCase(Trim(txtName(i).Text))
rs("age") = UCase(Trim(txtAge(i).Text))
rs("preference") = txtPref
rs.Update
next i
It failed to work :
"Method of update of object recordset failed"
Can anyone help me?
Vijooo
April 3rd, 2001, 01:03 AM
Hi
If u use the Update Method, U will have to use
either Addnew or Edit method.
The code should look like
for i = 0 to 3
rs.Addnew ( or ) rs.Edit
rs("name") = UCase(Trim(txtName(i).Text))
rs("age") = UCase(Trim(txtAge(i).Text))
rs("preference") = txtPref
rs.Update
next i
All the best
Bye Bye take Care
Vijooo
Cimperiali
April 3rd, 2001, 01:21 AM
...and use edit to modify existing records. Use addnew to create a new record. Do not forget to rate Vijoo if he helped you.
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
Blue Sky
April 3rd, 2001, 06:06 AM
Vijooo, I have tried what you have suggested, but there is no Edit method !!!
I can only find EditMode method instead.
When I used rs.EditMode, it prompted an error "Invalid use of property".
What's wrong ???
Please help me
Iouri
April 3rd, 2001, 07:08 AM
Edit exists only for DAO, for ADO you don't have to use rs.Edit
Iouri Boutchkine
iouri@hotsheet.com
Vijooo
April 3rd, 2001, 07:17 AM
HI
If u r using ADO, then u wont be having the
Edit Method. If u r working with DAO then it
can be used.
Anyway , Idf u want to edit a Particular record
Then use the Execute Method with SQL Query.
Sql query will look like this.
For Edit
Update [Table Name] Set [Field Name] = Values
Where Condition.
For Addition
Insert Into [Table Name] ( values )
Make the queries to execute in Execute Method.
This is the best way to work with ADO.
Mail me back about the status.
All the best
Take Care Bye Bye
Vijooo
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.