Solved

Calendar1

Posted on 2001-09-11
3
293 Views
Last Modified: 2008-03-06
I have the Calendar1 control on my form and when a textbox gets focus the calendar comes up. I would like it to display todays date, not a hard coded date.
Can this be done, if so how?

Thanks
0
Comment
Question by:mscala
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:baltman
ID: 6474387
You can do this by setting the properties for the calendar when the form loads (or on any action you choose). I will use the example when the form loads:

Private Sub Form_Load()
  Calendar1.Day = dayNow
  Calendar1.Month = monthNow
  Calendar1.Year = yearNow
End Sub

You would have to assign the values to dayNow, monthNow and yearNow with the Date function.

Hope this helps.

BA
0
 
LVL 10

Accepted Solution

by:
Eduard Ghergu earned 10 total points
ID: 6474451
Private Sub Form_Load()
  Calendar1.Value = Now
End Sub
0
 
LVL 27

Expert Comment

by:planocz
ID: 6474485
you can also use the format statement to view in your textbox....

calendar1.Value = now
text1.text = format(calendar1.Value, "mm/dd/yyyy")
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question