?
Solved

Calendar Control 10...setting a default value

Posted on 2005-03-25
6
Medium Priority
?
2,169 Views
Last Modified: 2008-01-09
Can the calendar control be set so that by default it displays the current date? I put one into a form I'm working on and everytime I open it it highlights 3/23/05 (the creation date). I cant use a hard value because I want it to display the current date as a default. It is being used to select a day to pull a report from and the most common is current day. I tried putting date() in value property...no go oon that. Did not see a default value area or anything. Please help!!! Thanks!
0
Comment
Question by:dbase118
[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
6 Comments
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13630281
You could programmatically set it in the form's Open event (or better yet, ditch the Calendar control completely and write your own :-)
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 13630308
On my form, I did it like this:

Me.Calendar4.Value = "4/1/1985"

You can set the value, for example, in the form's OnLoad event:

Private Sub Form_Load()

Me.MyCalendarControl.Value = "4/1/1985"

End Sub

Additionally, look in the object browser for the different methods associated with the control.  There are methods to increment the day, month, or year, or even set the control to today's date.
0
 
LVL 15

Author Comment

by:dbase118
ID: 13630311
"You could programmatically set it in the form's Open event (or better yet, ditch the Calendar control completely and write your own :-)"----Im afraid I am programmatically challenged.

I actually did try setting it OnOpen but he problem with setting the value is that once it was written into the Value property, I could not change by clicking a new date.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 34

Assisted Solution

by:Mike Eghtebas
Mike Eghtebas earned 500 total points
ID: 13630322
CalendarControlName = Date()

in form's Open event as stated above.
0
 
LVL 51

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 13630412
Try this:

1) Create a new form.  Place a calendar control (called MyCalendar) and a command button (called MyButton) on the form.
2) For the button, right click, and select "Build Event.."  When you get to the code window, make sure you are editing the OnClick event.
3) Make the event look exactly like what is shown below:

Private Sub MyButton_Click()   '<--- If you named your button differently, this line should reflect YOUR button's name
Me.MyCalendar.Value = "4/1/1985"
End Sub

4) Run the form.  Select a date on the calendar control.  Click the button.  Select a date.  Click the button.  So on.  Understand?
0
 
LVL 15

Author Comment

by:dbase118
ID: 13630746
Thanks for the help....Gave you both points. In actuality...I had the right idea all along but before I could set the value in the On Open. I had to change the ValueIsNull property to yes or the OnOpen would not overwrite. So It was essentially
something like

Forms![EOD Report Log].Calendar2.Value=date
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

777 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