473,386 Members | 1,819 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,386 software developers and data experts.

Adding current date to a file name automatic

Dear sirs i create a macros in access 2010 and i choose " export with formatting."
Inside the "output file" i wrote the below:
Expand|Select|Wrap|Line Numbers
  1. "C:\documents and settings\rabih\desktop\abr\cl-" & format(date(), "yymmdd") & ".pdf"
The above didn't worked so what is wrong with the code
Apr 11 '14 #1
13 5326
zmbd
5,501 Expert Mod 4TB
1) Macro or VBA

Macro is NOT equal to VBA. These are two separate programming languages used within Access

2) You tell us what the issue is, what is this doing vs. what it is that the code is doing.

Because when I resolve your string using today's date it returns: C:\documents and settings\rabih\desktop\abr\cl-140411.pdf

3) So it seems that your should, perhaps, trouble shoot your entire code - follow the guidelines given here:[*]> Before Posting (VBA or SQL) Code

4) Once you've followed the basic trouble shooting as given in #3 above, then post your entire code, please format it using the [CODE/] format button in the post-toolbar.
Apr 11 '14 #2
Sorry for the missunderstanding i am using access macro only and this code didnt returned your result it simply provide me error #2302
Apr 11 '14 #3
jimatqsi
1,271 Expert 1GB
Salame,
I had to Google error 2302 to get the description. That's something you should have provided from the beginning. Help us help you.

I found this link informative:
http://support.microsoft.com/kb/226526

The upshot of it is that the most likely error is the path does not exist. Assuming you were logged in as user rabih scurity should not have been the cause of hte problem.

Why don't you step toward a final solution by making a simple change to the macro. First, make a folder at C:\Temp. Just to be sure you have security privileges, copy and paste anything to that folder.

Then change your macro to deposit the file in C:\Temp. Whether the macro works or not you will have learned something. Come back and let us know if it worked or not and we can go from there.

JIm
Apr 11 '14 #4
I can copy and open a folder in c: no problem but i tried the code and didnt worked same error i tried also the below

"C:\br-" & format(date(), "ddmmyy") & ".xlsx"
Same error
Apr 11 '14 #5
jimatqsi
1,271 Expert 1GB
Leave the output format and filename blank. Access will ask for those when you run the macro. Play with different answers, different types and paths. Especially type ... maybe there is some dependency that is not fulfilled. Try html format, that should be free of any dependency.

Jim
Apr 11 '14 #6
zmbd
5,501 Expert Mod 4TB
1) Open the macro in edit view
2) Select/click into one line
3) <ctrl><a> to select ALL of the lines of code
4) <ctrl><c> to copy the code to the clipboard
5) in the post box for this thread, click on the [Code/] button in the toolbar
6) place your coursor between the [code] [/code] tags
7) <ctrl><v> to paste your macro code in between the [code] [/code] tags
8) smile and post.
Apr 13 '14 #7
NeoPa
32,556 Expert Mod 16PB
The macro command you are using does not take code. It needs a string value (without quotes). Not an expression.

This failed :
Expand|Select|Wrap|Line Numbers
  1. "C:\Temp\APB20140414.Xls"
This worked :
Expand|Select|Wrap|Line Numbers
  1. C:\Temp\APB20140414.Xls
Apr 13 '14 #8
zmbd
5,501 Expert Mod 4TB
NeoPa, did OP post the macro script?
I don't see it on my side of the pond.
Apr 14 '14 #9
NeoPa
32,556 Expert Mod 16PB
No Z. Nothing more than the OP itself.

The description of the macro and the parameter they did include showed me that they were expecting the expression to resolve to a string. This won't happen as the macro command expects a resolved string value without quotes (as explained in previous post).
Apr 14 '14 #10
zmbd
5,501 Expert Mod 4TB
Shows my inexperience with the macro side... learned vba and never looked back
(z.... come to the darkside... macros are your friend... OH NO, LOOK OUT MR BILL!)
Apr 15 '14 #11
jimatqsi
1,271 Expert 1GB
Maybe when I have 28000+ posts I won't say this, but working in Access, I believe I could learn something new every day no matter how long my career lasts.

Jim
Apr 15 '14 #12
zmbd
5,501 Expert Mod 4TB
J - I don't think at even that many posts I'll be anywhere near to scratching the surface. Access is a lot like Chemistry, the more I learn the more I realize that I truely I know, let alone understand, very little of the totality!
I think that's what's so fun about both!
(^_^)
Apr 15 '14 #13
NeoPa
32,556 Expert Mod 16PB
That's where we differ Jim. I can expect to learn something every day in Access. I'm now communicating regularly with other Access MVPs and past MVPs and there's much I still pick up frequently (Maybe not completely new every day but it never gets boring).

@Z.
Like you I know very little about macros and I have a very healthy distrust of them generally and any projects that include them. However, I guessed where the problem might be and knocked one up in an existing database to test out my hypothesis. Obviously, I deleted it again once I'd found out what I needed to know ;-)
Apr 15 '14 #14

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

Similar topics

3
by: Reginald Blue | last post by:
stupid question: RemotingConfiguration.Configure("MyProject.exe.config"); (where the actual EXE that's built is named "MyProject.exe", of course). is there any way to do that without hard...
2
by: markryde | last post by:
Hello, I am trying to add the current date to a file name in python script like thus: import os import sys import rpm import time import datetime
4
by: thehuby | last post by:
How do you get the name of the currently execting script? By this I mean the name of the include file that is being executed: File: include.php <?php //Call some function to display...
6
by: ninrulz | last post by:
I have created a database that has over 70 queries and over 40k records. I used the OutputTo action to export the queries to Excel. I would like the functionality of adding the date (Month-YY) to...
1
by: thokala | last post by:
Hi Everyone, I have XML file. It have some date to display the Graph. In that file i need to provide the date value. I would like to give the current date instead of hard coded date. I tried...
5
by: bruce24444 | last post by:
I have a database which assigns warranty claims to people with a main screen showing number of files assigned to each person. The number assigned shows day, week, month and year numbers so they can...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
1
by: kayox007 | last post by:
hello everyone, please i need help, i intend uploading 5 pictures all at once with each file fields named pic 1 to pic 5, the first field is compulsory , but am finding it hard getting their file...
8
by: neelsfer | last post by:
Some of clients have an backend linked file that needs to be renamed. This file is not the same for my different clients. What i have in mind is to use VBA to find the current backend file name...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.