Solved

Calendar1

Posted on 2001-09-11
3
285 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
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now