Hey Dutch/Peter - Help! :)

Results 1 to 3 of 3

Thread: Hey Dutch/Peter - Help! :)

  1. #1
    Carolyn Guest

    Default Hey Dutch/Peter - Help! :)

    Yesterday, I asked this question:<BR><BR>I want to create a macro or module in Access that, when I click on a button, it will import a file. The problem is, the file name won&#039;t be the same every time. For instance, I have a file that is set up exactly the same every month. I want to import it and have it come into access the same way (it is a .csv file) every month. But I don&#039;t know how to "pause" the macro (if that is what I need to do) to grab the file each month. If I am not explaining this well, please let me know and I will try to be more specific. I just don&#039;t even know where to start on this one. Thanks for any help... <BR><BR>You then responded and asked if I wanted to do this from Access itself and asked if I wanted to have it prompt for a file. That is exactly what I want. But then once the user would input the file name, I would want the macro to take back over. Do you know how to do this?

  2. #2
    Join Date
    Dec 1969

    Default RE: Hey Dutch/Peter - Help! :)

    OK, it&#039;s not really ASP (well actually it has *nothing* to do whith ASP) but here you go:<BR><BR>Create an form with one button (name: cmdImport), go to the Visual Basic screen of the form an type the following:<BR><BR>/////<BR><BR>Private Sub cmdImport_Click()<BR>Dim sFile As String,sDefaultPath as string<BR>sDefaultPath = "c:my documents\"<BR>sFile = InputBox("Please enter filename", "Filename")<BR>sFile = sDefaultPath & sFile<BR><BR>DoCmd.TransferText acImportFixed, [Specificationname], [TableName], sFile, [HasFieldnames]<BR><BR>End Sub<BR><BR>////////<BR><BR>You will be prompted for an filename, this filename will then be imported into the access db. Look in the help on TransferText for more info.<BR><BR>In this example I&#039;ve used "c:my documents" as the default folder, this can be anything you like, or you can just leave it empty and fill out the complete path & filename in the inputbox.<BR><BR><BR>This should get you started I guess.<BR><BR>Peter

  3. #3
    Carolyn Guest

    Default RE: Hey Dutch/Peter - Help! :)

    Thank you. I know it isn&#039;t ASP, but I don&#039;t know where else to go for these types of questions. I will try this out. Thanks again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts