Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    The month is also present in the file name you can just extract the month part of the file name and convert it to a month name.

  2. #17
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    I changed ".xlsx" to ".dbf" and it is still dropping the excel stuff into the table...

    I assume it has something to do with

    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12,

  3. #18
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    correct, you're no longer importing a spreadsheet, you're importing data from a file, the same methodology applies you just have to set up an import spec a set the location of your database as a trusted location and you should be fine.

  4. #19
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    ok im not exactly sure what im supposed to change spreadsheet too...

  5. #20
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    what do i need to change this too if i am using dbase files?

    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12,

    I changed, If Right(sFileName, 5) = ".xlsx" Then, to If Right(sFileName, 4) = ".dbf" Then

  6. #21
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    This might help. TransferSpreadsheet applies to spreadsheets. You are importing data from a data base.

    http://msdn.microsoft.com/en-us/libr...ice.10%29.aspx

    Alan

  7. #22
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    I was looking at that page as well alan but I can't seem to get the syntax to work for importing a dbf file, it keeps telling me it can't find the source file when it's actually there. I'm still trying to find a solution.

  8. #23
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    if the easiest solution is to save the DBF as an excel file then that is what I will do.. I was just trying to avoid as much leg work as possible.

  9. #24
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    If you don't have to use VBA, then a simple import using the Get External Data Wizard should work.

    See this:
    http://www.census.gov/support/Access.html

    also because I don't have any dbf files to test, this may be your solution:

    http://www.sikhphilosophy.net/inform...-with-vba.html

    Alan

  10. #25
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    Ok, this should do it, again I have included some dbf files and a delete macro that purges the table between tests.

    The vb code is testing for files that match the format

    mmddyy.dbf

    Anything that doesn't match that will be ignored so if you're testing with a different file naming convention you'll have to change that part of the code.

  11. #26
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    On this DBF database; I try to run the module and it is asking for a Macro Name.

  12. #27
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    just make sure your cursor is between the SUB and END SUB of the module and click the green arrow and it will run without asking you

  13. #28
    kwooten is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    255
    ok thanks....

    I have another need if you are up for it...

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-06-2011, 08:37 AM
  2. Append Query
    By waqas in forum Queries
    Replies: 5
    Last Post: 09-02-2011, 11:22 AM
  3. Replies: 7
    Last Post: 07-21-2011, 01:01 PM
  4. append query help
    By SlowPoke in forum Access
    Replies: 2
    Last Post: 09-25-2010, 10:47 AM
  5. Append query won't append
    By yelkenli in forum Queries
    Replies: 5
    Last Post: 02-12-2010, 11:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums