Automatic Month Field

V

viper

Though I am fairly new at this I have been trying to figure as much as
I can on my own. However, I need help on creating a field on a form
that would automatically state the current month whenever a user opens
the form. This date would then be posted to a table. The posting
part I understand the date part I can not figure out. Any help would
be appreciated.


Thanks
Joel
 
M

Mark A. Sam

Hello Joel,

This is just a quick procedure I wrote up, but it could be turned into a
function if you use it a lot.

On the form, place a textbox named [txtMonth]

In the Open, Load, or Current event of the form paste this code:

Select Case Month(Date)

Case 1
[txtMonth] = "January"
Case 2
[txtMonth] = "February"
Case 3
[txtMonth] = "March"
Case 4
[txtMonth] = "April"
Case 5
[txtMonth] = "May"
Case 6
[txtMonth] = "June"
Case 7
[txtMonth] = "July"
Case 8
[txtMonth] = "August"
Case 9
[txtMonth] = "September"
Case 20
[txtMonth] = "October"
Case 11
[txtMonth] = "November"
Case 12
[txtMonth] = "December"

End Select

God Bless,

Mark A. Sam
 
K

Klatuu

In the Control Source of the text box where you want to show the month:

=Format(Date,"mmmm")
 
V

viper

In the Control Source of the text box where you want to show the month:

=Format(Date,"mmmm")
--
Dave Hargis, Microsoft Access MVP






- Show quoted text -

Dave, had to tweak the properties but your suggestion I used on my
other form and it worked very well also.
Thanks
Joel
 
Top