N
Necromis
Below is my code I copied from another area and modified just as a
test to spit the info to a listbox. However, what I am trying to
accomplish is to store the data into variables so that I can use it
later with SendMessage and WM_SETTEXT. Can anyone offer how to tweek
this to make that happen. Thanks.
On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H1
Dim objConnection As Object
Dim objRecordset As Object
Dim strPathToTextFile As String
Dim strFileName As String
objConnection = CreateObject("ADODB.Connection")
objRecordSet = CreateObject("ADODB.Recordset")
strPathToTextFile = "F:\"
strFileName = infileBox.Text
objConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended
Properties=""text;HDR=YES;FMT=Delimited""")
objRecordset.Open("SELECT * " & strFileName & "", _
objConnection, adOpenStatic, adLockOptimistic,
adCmdText)
Do Until objRecordset.EOF
ListBox1.Items.Add("Acctno: " &
objRecordset.Fields.Item("Acctno"))
ListBox1.Items.Add("expiration Date: " & _
objRecordset.Fields.Item("expirdte"))
ListBox1.Items.Add("First Name: " &
objRecordset.Fields.Item("name1"))
ListBox1.Items.Add("Last Name: " &
objRecordset.Fields.Item("name2"))
objRecordset.MoveNext()
Loop
End Sub
test to spit the info to a listbox. However, what I am trying to
accomplish is to store the data into variables so that I can use it
later with SendMessage and WM_SETTEXT. Can anyone offer how to tweek
this to make that happen. Thanks.
On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H1
Dim objConnection As Object
Dim objRecordset As Object
Dim strPathToTextFile As String
Dim strFileName As String
objConnection = CreateObject("ADODB.Connection")
objRecordSet = CreateObject("ADODB.Recordset")
strPathToTextFile = "F:\"
strFileName = infileBox.Text
objConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended
Properties=""text;HDR=YES;FMT=Delimited""")
objRecordset.Open("SELECT * " & strFileName & "", _
objConnection, adOpenStatic, adLockOptimistic,
adCmdText)
Do Until objRecordset.EOF
ListBox1.Items.Add("Acctno: " &
objRecordset.Fields.Item("Acctno"))
ListBox1.Items.Add("expiration Date: " & _
objRecordset.Fields.Item("expirdte"))
ListBox1.Items.Add("First Name: " &
objRecordset.Fields.Item("name1"))
ListBox1.Items.Add("Last Name: " &
objRecordset.Fields.Item("name2"))
objRecordset.MoveNext()
Loop
End Sub