Date formatting issue

Volkof

New Member
Joined
Oct 16, 2011
Messages
37
In a form I have a txtBox " StartDate" . When the form initialise, I have a Macro which sets up a temp variable " tmpStartDate" which is equal to =Date() and displays this value in the txtStartDate txtbox . I have formated the txt to ShortDate ( dd/mm/yyyy) however the value displayed is: "01/01/1900 5:08:34 PM" or a long E nr 1.34637188208617E-03 .

When I try to format the tempVar as a Date it gives me the error message that Access can't find "Jul" object.

Can you help me in displaying the correct date in the text box and what should I do?

Thank you.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Without seeing your code it is difficult to say, but to format a date try

Code:
[COLOR=#333333]tmpStartDate = Format(Now(),"dd/mm/yyyy")[/COLOR]
 
Upvote 0
Hi, thanks for the reply. It's not VBA code, it's just 2 macros.
1. SetTempVar - Name expression = =Format(Now(),"dd/mm/yyyy") still the same result
2. SetProperty - ControlName txtStartDate - Value - =[TempVars]![tmpStartDate]

Issue is with tmp variable. It transforms the date. I also messagebox =Date() and it turns out a normal date.
 
Upvote 0
Macros are VBA code...

Can you post the Macro Code you use?
 
Upvote 0
Macros are <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: rgb(0, 0, 0); cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VBA</acronym> code...
Not exactly...
In Access Macros and VBA are a little different. Macros are their own Object, while VBA is code in the Modules Object.
In Excel, those terms are used interchangeably and they are really the same thing, but when people talk about Macros and VBA Code in Access, that can mean two different things.
 
Last edited:
Upvote 0
Ohhhh, I am sorry I did not realize this was for Access... I was just scanning issues in the "Zero Reply Posts", I thought this was for Excel, I am sorry again... ignore my posts on this then, I know very little about Access...
 
Upvote 0
Ohhhh, I am sorry I did not realize this was for Access... I was just scanning issues in the "Zero Reply Posts", I thought this was for Excel, I am sorry again... ignore my posts on this then, I know very little about Access...
Yes, be careful with that! The "Zero Reply Posts" shows all threads, not just Excel ones.
In "Zero Reply Posts", the second column from the end shows which forum the thread listed can be found in. Many people miss that...
 
Upvote 0
Volfof,
Which version of Access are you using?
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,388
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top