473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Code to Import sheet everyday with that day's date as part of name

34
Hi

I need to import excel sheet to access - the sheets are stored everyday with the same name, but with the day's date at the end of the name to distinguish them. What code can one use to import the sheets automatically? at this stage I use the code:

Expand|Select|Wrap|Line Numbers
  1.  DoCmd.TransferSpreadsheet acImport, , "Tbl Facility", "D:\My Documents\Facility Types.xls", True 
it works, but if there is a date at the end of the name that changes everyday, how does the code then need to look?

Thanks,

R
Nov 29 '07 #1
3 1265
FishVal
2,653 Expert 2GB
Hi, Riun.

Use Date() function to get current date and Format() function to format it suitably.

e.g.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim strDate as string
  3.  
  4. strDate = Format(Date,"""(Saved on:"" mmm-dd-yyyy)")
  5. DoCmd.TransferSpreadsheet acImport, , "Tbl Facility", "D:\MyDocuments\Facility Types " & strDate & ".xls", True 
  6.  
Nov 29 '07 #2
Riun
34
Thanks FishVal! It works! Cheers
Nov 29 '07 #3
FishVal
2,653 Expert 2GB
You are welcome.

Best regards,
Fish
Nov 29 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dafella | last post by:
The following is code from Xeoport. It is suppose to access my pop3 account and load email into Mysql database. It's not inserting and there is no log or anything to tell me why. Here is the...
0
by: Chris McKeever | last post by:
I am trying to modify the Mailman Python code to stop mapping MIME-types and use the extension of the attachment instead. I am pretty much clueless as to what I need to do here, but I think I have...
3
by: Jeff Marcum | last post by:
I have a database set-up to do file comparisons. I import the files into the database and do the comparisons with queries. I have to do this comparison on a daily basis so I would like to set up...
0
by: AR Hall | last post by:
This code goes through 3 work sheets in the same XL workbook, day, eve and night shift in each sheet their are columns representing production work orders and reject and downtime for each order...
8
by: Nick M | last post by:
Hello All, Excellent info here Thanks! I am very new to using access in general and I am on a learning curve. I'm trying to import an excel workbook (with worksheets) into an access db via a...
6
by: Dirk Reske | last post by:
Hello, I write an app that, logs events. how can I make, that everyday a new file whould be createt, with the date as name? thx -- ----------------------------------------------------
1
by: Devilxpto | last post by:
I need help on how to import a Flat file source into SQL database, but the name of the file (part of the name) changes everyday. How can I create a method to import the file everyday into a new table...
0
by: ClassicNancy | last post by:
If I want to remove the drop down for the year will that make the birthday not show on the calendar? If it looks like it is ok to remove it what can be removed?? What should it look like? ...
1
by: beingnick | last post by:
Hello, I am using Access 2007, but need to be compatible with 2003. I am importing a sheet from Excel into Access (code below). I would like the sheet name to be determined from a drop down on a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.