CSV Auto Import

  • Thread starter Thread starter dyfrig
  • Start date Start date
D

dyfrig

Guest
I have a database that exports data in CSV format from our management system as that system cannot do what we want

A CSV File is created every time the process is run on the system therefore the filename for the imported data changes from week to week

so I have designed a database but now have found out that the TransferText function that I have used will not work as it needs a static location to reference too

I have seen some examples of using the Common Dialog Box to select the file and output the full path of the file to a textbox

But im not sure as to how to call that textbox as part of the DoCmd.TransferText Command

Can anyone help
 
Forms!Formname!TextBoxName

Is that what you mean
 
If i was to call a static file I would enter

DoCmd.TransferText acImportDelim, , tblname, filename, True

But i need to have the filename part of this command to be replaced with the string from the text box
 
This is what I use to transfer spreadsheets so it should be similar

Dim tmpFilePath As String
tmpFilePath = Me!txtFilePath 'This is a field on my form
DoCmd.TransferSpreadsheet acImport, 8, "ImpRates", tmpFilePath, False, ""


I populate the form's field from a dialog box created from the sample code from Oldsoftboss in the Sample Database section under Common Dialog Boxes
 
I have done something similar where I call an input box and then use the value as the location for the transfertext

e.g.:

sub temp
path = inputbox("Where is the file?")
DoCmd.TransferText acImportDelim, , "newtable", path, True
end sub
 

Users who are viewing this thread

Back
Top Bottom