By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,646 Members | 2,098 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,646 IT Pros & Developers. It's quick & easy.

Calling of records from table through command button and saving it to another table.

P: 50
Good morning guys, I have a problem regarding the usage of the command button in VB 6. I dont know what codes what i will gonna use. How will i gonna call the records from the table using command button and saving it from another table?
Nov 27 '07 #1
Share this Question
Share on Google+
3 Replies


lotus18
100+
P: 866
Good morning guys, I have a problem regarding the usage of the command button in VB 6. I dont know what codes what i will gonna use. How will i gonna call the records from the table using command button and saving it from another table?
bluethunder

Can you give us much more details of what you wanted to do. What database connection are you using? : )
Nov 27 '07 #2

P: 50
bluethunder

Can you give us much more details of what you wanted to do. What database connection are you using? : )
I'm using access database connection.
Nov 27 '07 #3

9815402440
100+
P: 180
hi
open a new standarad exe project (if you are not familiar with vb6 then open new DataProject). create command button. and double click on it. add following code in the click event to connect the database and to access records from the table.

Dim cn As New ADODB.Connection
Dim rst As New ADODB.Recordset
With cn
.Provider = "MsDataShape" 'I use DataShape you can modify as per your requirment
.Properties("Data Provider") = "Microsoft.Jet.OLEDB.4.0"
'use following line only if your database is password protected
.Properties("Extended Properties") = "Jet OLEDB:Database Password= yourPassword"
.Properties("Data Source") = App.Path & "\Data.mdb"
.Open
End With
rst.Open "Select * from YourTable", cn, adOpenDynamic, adLockBatchOptimistic, 8
With rst
.MoveFirst
While Not .EOF
Debug.Print .Fields(0).Value
.MoveNext
Wend
End With

regards
manpreet singh dhillon hoshiarpur
Nov 27 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.