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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bluethunder
    New Member
    • Sep 2007
    • 50

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

    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?
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    Originally posted by bluethunder
    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? : )

    Comment

    • bluethunder
      New Member
      • Sep 2007
      • 50

      #3
      Originally posted by lotus18
      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.

      Comment

      • 9815402440
        New Member
        • Oct 2007
        • 180

        #4
        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.Connectio n
        Dim rst As New ADODB.Recordset
        With cn
        .Provider = "MsDataShap e" 'I use DataShape you can modify as per your requirment
        .Properties("Da ta Provider") = "Microsoft.Jet. OLEDB.4.0"
        'use following line only if your database is password protected
        .Properties("Ex tended Properties") = "Jet OLEDB:Database Password= yourPassword"
        .Properties("Da ta Source") = App.Path & "\Data.mdb"
        .Open
        End With
        rst.Open "Select * from YourTable", cn, adOpenDynamic, adLockBatchOpti mistic, 8
        With rst
        .MoveFirst
        While Not .EOF
        Debug.Print .Fields(0).Valu e
        .MoveNext
        Wend
        End With

        regards
        manpreet singh dhillon hoshiarpur

        Comment

        Working...