How can I import a file with an unknown extension ?

Hey guys,

How do I import a *.JUZ file which is simply a txt file ? And I would like to create a button to display the data on the form before the import. Thanks in advance for the help.


JUZ-file.jpg
SheogorathAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
You need to create an Import Specification to do this automatically

To create the Import Specification
1) Click on external data> text file which then opens another window called "Get external data - Text file"
2) Use radio button to select "Import the source data into a new table in the current database"
3) specify the source of the file using the browse procedure then click OK
4) Choose radio button to select delimited format and then click next
5) this window allows you to choose delimiter and text qualifier and if first row contains names - click next
6) This window allows you to type the name of the field in the Field Name column, choose data type, and if you want field indexed - also can choose to skip field - then click next
7) This window allows you to add primary key or designate field as such - click next

8) Click on ADVANCED button

9. in the import specification window
type the name of the field in the Field Name column
(here you can use the field names of the destination table, specify data type,
check the box Skip if you do not want to import the column)


10 click save as, give the specification a name <-- this is the specification name that you will use in the command line below


DoCmd.TransferText acImportFixed, "ImportSpecificationName", "NameOfTable", "C:\Sample.txt", False

0
 
Rey Obrero (Capricorn1)Commented:
can you change the file extension to  .txt and open the file in notepad?

if you can you can import the text file into an access table

File > get external file > import
select the file type .txt
select the file clikc ok
follow the import wizard

if you want ot do this using vba codes,
in the process of importing, click Advanced button from the Import wizard window and creatre an Import Specification
0
 
SheogorathAuthor Commented:
Thanks for your response. Yes, I can. The image attached above shows how it looks. But I don't want to go through the same import process every time an import needs to be made.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
Rey Obrero (Capricorn1)Commented:
<But I don't want to go through the same import process every time an import needs to be made. >

you can do this using vba codes
0
 
Rey Obrero (Capricorn1)Commented:
what version of Access are you using ?
0
 
SheogorathAuthor Commented:
I am using Access 2007.
0
 
SheogorathAuthor Commented:
I would like to use vba code but I need a sample :)
0
 
Rey Obrero (Capricorn1)Commented:
upload a copy of the text file and a copy of your db..
0
 
Jeffrey CoachmanMIS LiasonCommented:
<And I would like to create a button to display the data on the form before the import.>
Then you have really two questions here.
1. Display an unknown text file in a form
2. Import the unknown file.

If "displaying" this file in a form is your first concern, then this will be difficult to do without this data first being imported into a table.
(So we have a bit of a Circular Logic scenario here.)
It would probably be most straightforward/simple to just to open the file in notepad...

I'll let capricorn1 help you with the import...


0
 
SheogorathAuthor Commented:
OK, Thank you. Here they are.
SAMPLE.txt
DatabasesSample.accdb
0
 
Rey Obrero (Capricorn1)Commented:
explain  where the information from the text file will go (name of table, name of fields)
0
 
SheogorathAuthor Commented:
Thank you. I still would like to convert .JUZ to .txt with the button but i guess that would be a new question.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.