Date Format in Code (1 Viewer)

JeffAccess

Registered User.
Local time
Today, 05:56
Joined
Aug 26, 2013
Messages
21
Hi
I'm using Access 2007.
I am needing to duplicate a field (It is necessary)

I use the following code.
Private Sub Confirm_Course_Number_KeyPress(KeyAscii As Integer)
Me.Confirm_Course_Number = YearMonth
End Sub

It works exactly the way I want, however the date is showing long. What code do I put in for YearMonth to put it in the format of "ddmm"

Any help appreciated.
Jeff
 

missinglinq

AWF VIP
Local time
Today, 08:56
Joined
Jun 20, 2003
Messages
6,423
Assuming that YearMonth is a Control on the same Form:

Code:
Me.Confirm_Course_Number = Format(Me.YearMonth,"ddmm")
Linq ;0)>
 

JeffAccess

Registered User.
Local time
Today, 05:56
Joined
Aug 26, 2013
Messages
21
Assuming that YearMonth is a Control on the same Form:

Code:
Me.Confirm_Course_Number = Format(Me.YearMonth,"ddmm")
Linq ;0)>

Hi Missinglinq!
That was perfect!!!! How do you all know these things?
Thanks. Appreciate the help!:)
Jeff
 

JeffAccess

Registered User.
Local time
Today, 05:56
Joined
Aug 26, 2013
Messages
21
Missinglinq....
Just a quick question?
I was using the same control on the same form.
How does one go about using a control from another form?

Thanks again
Jeff
 

pr2-eugin

Super Moderator
Local time
Today, 13:56
Joined
Nov 30, 2011
Messages
8,494
Try..
Code:
Form![COLOR=Blue][B]FormName[/B][/COLOR]![COLOR=Red][B]ControlName[/B][/COLOR]
For a detailed matrix on referring Controls on other forms, Check out the Access MVP site.
 

JeffAccess

Registered User.
Local time
Today, 05:56
Joined
Aug 26, 2013
Messages
21
Try..
Code:
Form![COLOR=Blue][B]FormName[/B][/COLOR]![COLOR=Red][B]ControlName[/B][/COLOR]
For a detailed matrix on referring Controls on other forms, Check out the Access MVP site.

Sorry pr2-eugin. I'm still a newbie with this.
So my form name is "Attendance Register Marketing" and the ControlName is "YearMonth". How do I put it in? It tells me Compile Error, Expected end of statement and it highlights Register??
 

pr2-eugin

Super Moderator
Local time
Today, 13:56
Joined
Nov 30, 2011
Messages
8,494
Sorry there was a typo.. Try..
Code:
Form[COLOR=Red][B]s[/B][/COLOR]![Attendance Register Marketing]![YearMonth]
 

pr2-eugin

Super Moderator
Local time
Today, 13:56
Joined
Nov 30, 2011
Messages
8,494
Glad to help, and thank you for giving my 1000th Thanks. :D
 

Users who are viewing this thread

Top Bottom