borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Please Help Me)Next Topic (MSDE) New Topic New Poll Post Reply
AndreaVB Forum : Database : How to update it?
Poster Message
sneha
Level: Scholar

Registered: 28-03-2006
Posts: 29

icon How to update it?

Hi,

Private Sub Update_Click()
With rs
rs.Open "Update Sales Set Paid = PAID", db, adOpenDynamic, adLockOptimistic
End With
End Sub


I want to update the blank field (200 empty rows) with "PAID". The above code does nothing.
I am using MS Access database.
Table Name is : Sales
Field Name is : Paid

Please help.

Sneha

____________________________
Sneha

17-06-2006 at 01:13 PM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: How to update it?

Hi Sneha

If you want to use the update command then you do it with the connection and not the recordset.

Dim cn as adodb.connection
dim recs as long

set cn = new adodb.connection

cn.open <your connection string>

cn.execute "Update Sales Set Paid = 'PAID'",recs,adcmdtext

cn.close

set cn = nothing

msgbox recs & " records updated"



Steve



[Edited by steve_w on 18-06-2006 at 03:04 PM GMT]

18-06-2006 at 03:04 PM
View Profile Send Email to User Show All Posts | Quote Reply
sneha
Level: Scholar

Registered: 28-03-2006
Posts: 29
icon Re: How to update it?

quote:
steve_w wrote:
Hi Sneha

If you want to use the update command then you do it with the connection and not the recordset.


Steve




Thanks for your kind help.

Regards,


Sneha.

____________________________
Sneha
26-06-2006 at 04:26 PM
View Profile Send Email to User Show All Posts | Quote Reply
sneha
Level: Scholar

Registered: 28-03-2006
Posts: 29
icon Re: How to update it?

quote:
steve_w wrote:
Hi Sneha

If you want to use the update command then you do it with the connection and not the recordset.


Steve




Thanks for your kind help.

Regards,


Sneha.

____________________________
Sneha
26-06-2006 at 04:55 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : How to update it?
Previous Topic (Please Help Me)Next Topic (MSDE) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder