|
-
Sep 6th, 2003, 05:22 AM
#1
Thread Starter
New Member
Unable to assign a formated date to a label.caption
The following code which I have used many times will not work on my new database.
Today.Caption = Format(Now(), "d/m/yyyy")
It gives the message
"run time error 13 Type mismatch"
The code works in other databases on this pc. Library files are the same and in the same order. I don't understand why it won't work.
I would very much appreciate some help.
-
Sep 6th, 2003, 08:14 PM
#2
Is that the line that is highlighted after the error message has appeared? I used your code and it worked fine...
-
Sep 7th, 2003, 03:46 PM
#3
Thread Starter
New Member
Yes , thanks for your interest in my problem.
I have commented out the line of code "Today.Caption = Format(Now(), "d/m/yyyy")". No more error message and I can get on with the project. But I will have to conquer it soon. It works in other databases on my PC. The problem persists if I transport the database to work (another PC).
I appreciate that its a bit hard to work out someone elses problem without the full code. I am happy to send the DB to anyone that is interested.
-
Sep 7th, 2003, 07:55 PM
#4
Upload your project and i'll try and have a look for you.
-
Sep 7th, 2003, 08:45 PM
#5
Addicted Member
IS THAT LINE PASTED FROM YOUR CODE MIGHT THERE BE A SYNTAX ERROR? BECAUSE FORMAT GIVES THAT ERROR IF YOU DONT HAVE THE "d/m/yyyy"
CORRECT
-
Sep 8th, 2003, 03:07 AM
#6
Thread Starter
New Member
Unfortunately I don't know where to upload it to, and I don't seem to be able to email it through this forum.
I have imported a form which has exactly the the same code form another working database. Itworks in my new db. When I copy the label and the associated vba into the original form, it causes the error. It tends to suggest there is one of those hidden problems with the form, although appart from this problem it works perfectly.
-
Sep 9th, 2003, 01:07 PM
#7
Lively Member
This may sound like a dumb question but, WHAT is the version of your new database? Can I assume this is Access you're talking about? In your format make sure that you don't have to escape the backslashes ... It may be absorbing some of your format as escape sequences and that could be blowing it for you ...
-
Sep 9th, 2003, 03:26 PM
#8
Thread Starter
New Member
Problem Solved. Would you believe I had a field in the underlying table named "Format". Seems perfectly logical to me. I blame Bill.
Thanks for your help everyone. I hope you remeber reserved words in the tables when an Access form does not work for you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|