Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access table not importing into the right fields

Status
Not open for further replies.

mm2ha

Programmer
May 29, 2006
9
US
Hi, I have an access database and I import data to it automatically from a csv which comes to my email. However, the fields do not import to the ones they are supposed to and thats the problem which I have right now. The structure of the csv is this:
Name Gender Gpa Date Call

The structure of the table in access is this:
Name Gender Gpa Date Program Call

And what is messed up is the way how it is importing it. It is importing the Call from csv into Program in the access table. How could I change the positions of the Call in the access table to make it permanent so that it would import into that field? Or what other options do I have to fix this? thanks a lot for your help!
 
In the design view of your table, can't you just move your "Call" field before the "Program" field?
 
like rjoubert says, csv files are positional. the call should be before the program, for it to work.
 
Unfortunately, that did not help. The importing is still putting the values into Program. even though now the structure of the access table is this:
Name Gender Gpa Date Call Program

What could be the problem? Could it be caused by that the Call in the access table is a checkbox field? Thanks a lot for help!
 
This should be it:

For Each itm In objInboxItems 'check the Inbox for mail with your keyword
'if subject is correct and is not marked for deletion let's work with this mail item
' mark the email message as read
If (InStr(UCase(itm.Subject), "More Student Inquiries from All") > 0) Then
itm.UnRead = False

'make a temp file
strFile = "c:\Temp\Nursing Inquiries.txt" 'create a useful name

Set objAttach = itm.Attachments(1)

objAttach.SaveAsFile strFile 'save the attachment to disk

DoCmd.TransferText acImportDelim, "Nursing Inquiries Import Specification", "IH Nursing Inquiries", strFile, True

'move the email message
itm.Move fldr

Set objAttach = Nothing
Set objAccess = Nothing 'adios
End If
SkipMessage:
Next

I have not written the code, I just have to fix it:). The guy who wrote it is not working here anymore and now the databse is not fully working. Do you know what that "Nursing Inquiries Import Specification" is? The "IH Nursing Inquiries" is the main table with the data.
 
To modify the existing specification...
Go to File | Get External Data | Import. Select a CSV file to import (you don't actually have to import it so it can be any file). On the "Import Text Wizard" screen, click on the "Advanced" button. On the resulting screen, click on the "Specs" button to view the existing specifications.
 
Ok, thanks a lot! I have just changed it, but I have to wait for the new data to arrive. But hopefully it will work just fine, as I have changed the import positions. Thanks again for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top