• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 549
  • Last Modified:

Import text file into access

I have a large text file needs to be imported to a table in Access (attached is a sample). The first block has complete rows. The following 3 blocks are the variations. They all start with first, last name and end with Username, Password. Everything in between may or may not be there, or there may be a blank row. Every word that has ":" (Phone:) should be a field name.
Please help, thanks.
sample2.txt
0
AntiBook
Asked:
AntiBook
  • 2
  • 2
1 Solution
 
als315Commented:
Every word that has ":" (Phone:) should be a field name
Do you have full list of possible fields? If answer - no, there are following possible solutions:
1. In first pass collect all possible field names, create table and import data
2. Write data into 3 tables: First: UserID (autonumber), First and Last name, UserName, Password; Second - Table with possible fields (FIeldID, FieldName): Cod, Phone, etc.; Third with data: UserID, FieldID, Value.
Do you need strings without ":"?
0
 
AntiBookAuthor Commented:
the first block is the complete list of possible fields. So, "COD:", Phone:", "Username:", "Password:" are field names. They don't need to be imported, but the data after ":" needs to be imported. The rest of the rows don't have field names. You can name them whatever, and the whole row needs to be imported. Can you give me the vba code to do that? thanks
0
 
als315Commented:
Test this
DBTxtImport1.mdb
0
 
AntiBookAuthor Commented:
thanks again
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now