472,123 Members | 1,363 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,123 software developers and data experts.

one text file in to two different table

I have a bog problem in access
what i have to do is that
i have a text file that i have to insert it into access. but the problem is that there is two differnt type of data in my text file.
the one that have rpt:1 have differnt format of those who hast rpt:2. but they are all in one text file.
what i want to di is that i want to say that when ever rpt is equal 1 put in this table and whenever the rpt is 2 put in the other table.

i have to be able to read the text file and then send it into another table

i would appreciate any help.
thanks
Sep 14 '07 #1
3 1260
JConsulting
603 Expert 512MB
I have a bog problem in access
what i have to do is that
i have a text file that i have to insert it into access. but the problem is that there is two differnt type of data in my text file.
the one that have rpt:1 have differnt format of those who hast rpt:2. but they are all in one text file.
what i want to di is that i want to say that when ever rpt is equal 1 put in this table and whenever the rpt is 2 put in the other table.

i have to be able to read the text file and then send it into another table

i would appreciate any help.
thanks
can you post a small sample of the data...and how it looks in the file?

something like this may help out

Expand|Select|Wrap|Line Numbers
  1. Function importtxtfile(strFile As String) As Long
  2. Dim MyString As String
  3. Open strFile For Input As #1
  4. Do While Not EOF(1)
  5.     Line Input #1, MyString
  6.     'Here you can either parse your fields based on the delimiter
  7.     'or you can use the instr(mystring, "xxx") to identify what table
  8.     'then
  9.     'use an insert statement to put the line into the proper table
  10. Loop
  11. Close #1    ' Close file.
  12. End Function
  13.  
J
Sep 14 '07 #2
i havent done that much
i just create two tables with the fields.
if the report tybe be 1 then have different field with rport type 2.
also i dont wantt o enter all the fields that is in text field.
and also in my text field in one line there is two field in other line there is 3 field.
i may just need one field in one line and i also want to escape some lines.
if i want to explain i have to same that cosider that theree is comment card that the customer has fill it.
what i need is to get those fields that i need and then again go the next entry. this is a very big text file

thanks alot
Sep 14 '07 #3
JConsulting
603 Expert 512MB
i havent done that much
i just create two tables with the fields.
if the report tybe be 1 then have different field with rport type 2.
also i dont wantt o enter all the fields that is in text field.
and also in my text field in one line there is two field in other line there is 3 field.
i may just need one field in one line and i also want to escape some lines.
if i want to explain i have to same that cosider that theree is comment card that the customer has fill it.
what i need is to get those fields that i need and then again go the next entry. this is a very big text file

thanks alot
There has to be rules when it comes to automating the import of data. Without those , I do not know how to help you. I understand that you don't need ALL data...but to exclude some, or choose some based on some logic...YOU have to define that that is. I'll monitor this question if you can come back with some definition of that that is.
J
Sep 15 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

18 posts views Thread by Wade Leftwich | last post: by
7 posts views Thread by Sam Lowry | last post: by
4 posts views Thread by news | last post: by
4 posts views Thread by Jay | last post: by
10 posts views Thread by Eric Lindsay | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.