| | |
Access table data transfer to file
Please support our MS SQL advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2006
Posts: 20
Reputation:
Solved Threads: 0
Hi Guys,
I was just trying to transfer data from access tables to a txt file and then back from file into a table using following code
Is it possible to create and manipulate import/export specifications using the VBA code rather than the access manu so that I can make it work on different systems.
Thanks for your time
I was just trying to transfer data from access tables to a txt file and then back from file into a table using following code
MS SQL Syntax (Toggle Plain Text)
Private Sub Command0_Click() DoCmd.TransferText acExportDelim, "Db Export Specification", "AUTHENTICATION", "J:\Power Equipment\Common\SK\db.TXT" End Sub Private Sub Command1_Click() strSQL = "delete * from AUTHENTICATION_TEST" DoCmd.RunSQL strSQL DoCmd.TransferText acImportDelim, "Db Import Authentication Specification", "AUTHENTICATION_TEST", "J:\Power Equipment\Common\SK\db.TXT" End Sub
Is it possible to create and manipulate import/export specifications using the VBA code rather than the access manu so that I can make it work on different systems.
Thanks for your time
•
•
Join Date: Oct 2006
Posts: 2
Reputation:
Solved Threads: 0
Hi Saurabh,
It sounds to me like you require the ability to specify the Data-Type when importing fields into MSAccess, because sometimes MSAccess guesses the field types incorrectly.
I dont have the complete solution, but a suggested starting point.
The idea is to create a recordset (based on your SQL), and then read through it one record at a time. each record is then written to the textfile.
Theres a bit of code missing lol, this isnt a copy n paste solution my friend
Anyways, I hope I helped
good luck!
Private Sub Command0_Click()
'Create a Connection Object
'Create a Recordset object based on your SQL
Open "J:\Power Equipment\Common\SK\db.TXT" For Output As #1
While Not rst.EOF
Print #1, rst("ImageID") & vbTab & rst("ImageWidth" & vbCrLf)
Wend
Close #1
End Sub
Private Sub Command1_Click()
strSQL = "delete * from AUTHENTICATION_TEST"
DoCmd.RunSQL strSQL
DoCmd.TransferText acImportDelim, "Db Import Authentication Specification", "AUTHENTICATION_TEST", "J:\Power Equipment\Common\SK\db.TXT"
End Sub
It sounds to me like you require the ability to specify the Data-Type when importing fields into MSAccess, because sometimes MSAccess guesses the field types incorrectly.
I dont have the complete solution, but a suggested starting point.
The idea is to create a recordset (based on your SQL), and then read through it one record at a time. each record is then written to the textfile.
Theres a bit of code missing lol, this isnt a copy n paste solution my friend

Anyways, I hope I helped

good luck!
Private Sub Command0_Click()
'Create a Connection Object
'Create a Recordset object based on your SQL
Open "J:\Power Equipment\Common\SK\db.TXT" For Output As #1
While Not rst.EOF
Print #1, rst("ImageID") & vbTab & rst("ImageWidth" & vbCrLf)
Wend
Close #1
End Sub
Private Sub Command1_Click()
strSQL = "delete * from AUTHENTICATION_TEST"
DoCmd.RunSQL strSQL
DoCmd.TransferText acImportDelim, "Db Import Authentication Specification", "AUTHENTICATION_TEST", "J:\Power Equipment\Common\SK\db.TXT"
End Sub
![]() |
Similar Threads
- Get data out of excel file stored as an image (MS SQL)
- Help locking down access to client data from "outside" hacking. (Network Security)
- conversion of text file into data base file (Visual Basic 4 / 5 / 6)
- drop down list in VB6 from Access table (Visual Basic 4 / 5 / 6)
- printing an access table in VB6 (Visual Basic 4 / 5 / 6)
- empty or delete data index file in temp internet files (Windows NT / 2000 / XP)
- Create stats from a text file (Java)
Other Threads in the MS SQL Forum
- Previous Thread: Select Until ?
- Next Thread: mysql to msql data migration
Views: 4637 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last autogrowth business connectingtodatabaseinuse count cursor data database dateadd datepart day" dbsize deadlock delete_trigger exploit getdate hack highperformancecomputing hpc hpcserver2008 ibm iis limit live loop maximum microsoft ms mssql multiple multithreading news number password permission position query reporting result security server services sets single source sql sql-injection sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday





