|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
CSV to access conversion.
Good day,
Looking for convert CSV to Access automatically. How can I do this. I've got it to Access to CSV. Thank you - I've posted in... http://forums.aspfree.com/editpost.php?do=editpost&p=602693 but thought it might be more relavant to have a new thread. |
|
#2
|
|||
|
|||
|
Sorted :-) ....
Code:
Private Sub PrcImportBatch()
Dim db As Database
Dim rs As Recordset
'
'Strings
Dim strOrder_id As String
'
Dim strSQL As String
Dim strFileToOpen As String
Dim TestNum As String
Dim lngField As Long
Dim strTest1 As String
Dim Vfile
Dim X$
'
' The Database
Set db = DBEngine.OpenDatabase("C:\Documents and Settings\AddressLabels.mdb")
'
' Empty Data Source
strSQL = "DELETE * FROM 79;"
db.Execute (strSQL)
strSQL = ""
'
' The Text File
Vfile = "C:\batch " & txtBatchNumber.Text & ".csv"
strFileToOpen = CStr(Vfile)
'
' The Data Table within the Database
Set rs = db.OpenRecordset("Batch79")
'
' Open the Text File
Open strFileToOpen For Binary Access Read As #1
'
Do While Not EOF(1)
X$ = Input$(1, #1)
'
If X$ = "" Then
' move on
Else
TestNum = Asc(X$)
'
Select Case TestNum
'
Case 9 ' its a tab
Select Case lngField
Case 0
strOrder_id = "" & strTest1
strTest1 = ""
"
'
With rs
.AddNew
'#####################################
.Fields("order_id") = strOrder_id
'#####################################
.Update
End With
'
strTest1 = ""
lngField = -1
'############################################
End Select
lngField = lngField + 1
Case Else
strTest1 = strTest1 & X$
End Select
End If
Loop
'
Close #1
rs.Close
db.Close
'
cmdImportBatch.BackColor = &H80FFFF
'
End Sub
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > CSV to access conversion. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|