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 (displaying database)Next Topic (Coverting an MS access database) New Topic New Poll Post Reply
AndreaVB Forum : Database : ListBox Puzzle
Poster Message
pieterw0
Level: Guest


icon ListBox Puzzle

Guys
I have a complete db in access. I want to convert this Access db to Vb6. I have made SQL conversions in the main form and that is fine. What baffels me is, how to change the Access code in the following example in the attachment to Vb.
Is there someone that can change this for me so I can see how this is done or just give direction.
Am I using;
The correct listbox?
The correct controls?
The correct references?

It seems no such examples exist

Thanks
Pieter

____________________________
Attached:
ProjectTest.zip 13 KB (Downloads: 5)

25-09-2004 at 10:08 AM
| Quote Reply
pieterw0
Level: Guest

icon Re: ListBox Puzzle

Here is the Add code for who is interested

Dim db_file As String
Dim statement As String
Dim conn As ADODB.Connection
Dim ctl As Control
    
    ' Get the data.
    db_file = App.Path
    If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
    db_file = db_file & "Test.mdb"

    ' Open a connection.
    Set conn = New ADODB.Connection
    conn.ConnectionString = _
        "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & db_file & ";" & _
        "Persist Security Info=False"
    conn.Open

    ' Compose the INSERT statement.
    statement = "INSERT INTO tblName " & _
        "(fldName) " & _
        " VALUES (" & _
        "'" & NameInput.Text & "'" & _
        ")"

    ' Execute the statement.
    conn.Execute statement, , adCmdText
  
    ' Close the connection.
    conn.Close
      
      ' Clear the TextBoxes.
    For Each ctl In Controls
        If TypeOf ctl Is TextBox Then
            ctl.Text = ""
        End If
    Next ctl
    
       Form1.datName.Refresh

    Form3.Hide
      
End Sub

27-09-2004 at 07:59 PM
| Quote Reply
AndreaVB Forum : Database : ListBox Puzzle
Previous Topic (displaying database)Next Topic (Coverting an MS access database) 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