Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Put Today Date in Calendar control

Status
Not open for further replies.

hdesbiens

Programmer
May 2, 2004
77
CA
Hi

i have a calendar form and on the openform event i want to set my calendar to today date:

Me.Calendar0.Value = Format(date, "yyyy-mm-jj")

but it did'nt take the date i put i set the date to 2005-11-24 so i just don't understant why???

could someone help me please?

thanks a lot
 
Dim rs As Object
Dim StrWhere as string


Set rs = Me.Recordset.Clone
StrWhere = "[name of field in recordset] = " & "#" & Me.Calendar.Value & "#"
rs.FindFirst StrWhere
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

I believe this is what you are looking for?!? or do you have no recordset for the dates.. I don't know how your system works.

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Have you tried simply Date?

Me.Calendar0.Value = Date

I cannot tell how format works in other languages, but in my (English) version it would be "yyyy-mm-dd
 
oic...

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Hi

i dont have any recordset for that calendar form, i have simply a form with a calendar on it and a button that put the value in the field that called the calendar.

So when i open the calendar form i just want it to be a today date!

is there a way to do that?

thanks
 

Did you try the suggestions in my post?

Also, when I open my calendar control it is automatically set to today's date.
 
How are ya hdesbiens . . .

Code:
[blue]   Me!Calendar0 = Now()[/blue]

Calvin.gif
See Ya! . . . . . .
 
Yes i tried to put

Me.Calendar0.Value = Date

but dont work ans i tried this:
Me!Calendar0 = Now()

and don work to it stays at 2005-11-24

pretty weird!!!
 
it says 2006-08-24

thats why its very weird it seems that acces did not accept the value i put in it!!
 
This looks like a format problem from clock to access....

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Try using DateSerial

Me!Calendar0 = DateSerial(Year(Now()),Month(Now()),Day(Now())

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top