pieterw0 Level: Guest

|
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
|