473,730 Members | 4,296 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MSCAL.Calendar. 7 Default Date

JamesDC
66 New Member
Hey all,

How do I set the default date of my MSCAL.Calendar. 7 calendar to today's date? I have it on one of my forms so that an employee can click on a given date and bring up the records form there. I just want the data to automatically be today's date, instead of having to click the desired date (which in almost all cases will be the current day's date).

Thanks in advance,

James
Feb 12 '07 #1
21 20514
Michael R
176 New Member
Hey all,

How do I set the default date of my MSCAL.Calendar. 7 calendar to today's date? I have it on one of my forms so that an employee can click on a given date and bring up the records form there. I just want the data to automatically be today's date, instead of having to click the desired date (which in almost all cases will be the current day's date).

Thanks in advance,

James
You can add this to form's on open event, Calendar1 being your MSCAL.Calendar. 7 name property value:

Me.Calendar1.Va lue = Date
Feb 12 '07 #2
JamesDC
66 New Member
I have the form's on Open event set as Restore. How do I set multiple commands to this event? Such as the calendar update command?
Feb 12 '07 #3
Michael R
176 New Member
I have the form's on Open event set as Restore. How do I set multiple commands to this event? Such as the calendar update command?
Right-click on the square in the upper left corner of the form and click 'propreties'. A box should open with the title "Form". Go to event tab, click on the On Open event, and there will be appear a "..." button on the left. Click on it, and add the code between those lines -
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
right here
Expand|Select|Wrap|Line Numbers
  1. End Sub
If "Restore" was written on that line from where you pressed "..." that was probably a macro, so you should add this line:
DoCmd.RunMacro "Restore" to the code I gave you.

Close the VB window and view your form.
Feb 12 '07 #4
ADezii
8,834 Recognized Expert Expert
Hey all,

How do I set the default date of my MSCAL.Calendar. 7 calendar to today's date? I have it on one of my forms so that an employee can click on a given date and bring up the records form there. I just want the data to automatically be today's date, instead of having to click the desired date (which in almost all cases will be the current day's date).

Thanks in advance,

James
As previously indicated, assuming your Calendar Name is Calendar1 then place this code in the Form's Load Event - not Open:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.   Me![Calendar1].Value = Date 
  3. End Sub
Feb 12 '07 #5
Michael R
176 New Member
As previously indicated, assuming your Calendar Name is Calendar1 then place this code in the Form's Load Event - not Open:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.   Me![Calendar1].Value = Date 
  3. End Sub
Also, I forgot to mention, choose 'code builder' while pressing the "..." button from On Open event line in the propreties box.
Feb 12 '07 #6
JamesDC
66 New Member
THanks for the help so far,

I'm running into problems with the Date command. The person who created the database used Date as the name of a field in the database which makes the Date command in VB useless. Is there another way around this date issue? I've tried using Now(), but it causes an error that requires debugging, which I don't know how to fix :(

Also, is there a problem with having the calendar named Calendar? I'm not sure if that is also a command somewhere.
Feb 12 '07 #7
ADezii
8,834 Recognized Expert Expert
THanks for the help so far,

I'm running into problems with the Date command. The person who created the database used Date as the name of a field in the database which makes the Date command in VB useless. Is there another way around this date issue? I've tried using Now(), but it causes an error that requires debugging, which I don't know how to fix :(

Also, is there a problem with having the calendar named Calendar? I'm not sure if that is also a command somewhere.
__1 You should have no problem using Format(Now(), "mm/dd/yyyy") instead of Date.
__2 What is the nature of the Error caused by using Now()?
__3 Calendar is part of the Class Name defining the OLE Object as in MSCAL.Calendar. 7. Simply rename your Calendar Control to avoid possible Errors.
Feb 12 '07 #8
JamesDC
66 New Member
I have in the On Load event this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Me![Calendar1].Value = Format(Now(), "mm/dd/yyyy")
  3. End Sub
  4.  
And when I run my form i get this error:

Run-time error '2448':
You can't assign a value to this object.

I've changed the name of Calendar to Calendar1 so as to avoid the problems with its name, but I still get the error.

When I hit debug on the error it highlights the Me! line of code.

Any ideas on this?
Feb 12 '07 #9
Michael R
176 New Member
I have in the On Load event this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Me![Calendar1].Value = Format(Now(), "mm/dd/yyyy")
  3. End Sub
  4.  
And when I run my form i get this error:

Run-time error '2448':
You can't assign a value to this object.

I've changed the name of Calendar to Calendar1 so as to avoid the problems with its name, but I still get the error.

When I hit debug on the error it highlights the Me! line of code.

Any ideas on this?
As in VBA you write this: "me." does a dropdown menu opens with the different objects of me.? If yes look for calendar there and add to it ".value".
Feb 12 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
14880
by: cg_news | last post by:
In short, what I am trying to do is, based on a date, calculate the week of year (as described in ISO 8601), then calculate the first and last date in this week period and return them in the format CCYYMMDD. Sounds easy enough, right?? I am attempting to accomplish this by creating a GregorianCalender which will get me the week of year. Then by changing the day of week to 1 (start of week) i'm trying the get the first day of the week,...
0
3671
by: Tim Graichen | last post by:
Hello, I am making use of the Active X calendar control (mscal.Calendar.7) in several places in my main form, with the following code Below is an example of the code I'm using for the controls. Private Sub DateSold_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) SoldCal.Visible = True
0
4229
by: Michael Holberton | last post by:
Hi All, I have Access 97, 2000 & 2002 installed in different directories under Win2K Server on a new PC box I built. The Calendar Control on my Date Selector Form is not working and causing various problems. The file in C\winnnt\system32 appears to be the version for Access97. Even if I register the version for Access 2000, that resides in the Office directroy of my Office 2000 installation(or move it to the C\winnnt\system32...
8
2457
by: Shyguy | last post by:
Is it possible to create a calendar that shows previous input data and also allows for input of new data?
1
7293
by: jim_parent_804 | last post by:
Good morning: I created a data entry form that has been working well, and needed to redesign it. The form is called, and now the first field to be filled in is a date using the MSCAL.Calendar.7 ActiveXCtl. The calendar presently displays the current date. The first time the user enters the date on the form, the date resets to the current date, and the user must re-enter the new date. I also note that upon entering the form, the new...
2
1835
by: Mariano Padilla | last post by:
The calendar control only has the event of SelectionChanged to detect if the user clicks on the calendar. I have 2 calendars on a form, one for arrival date one for departure date. Every time a use clicks on the calendars, the proper date gets filled in the text boxes below the calendars. I noticed that if you click on the date correspinding to the current date, the textboxes do not get filled or changed. Is this a bug? If not how can...
3
3006
by: hellsgate | last post by:
Hey guys, I'm using MSCAL.Calendar.7 to allow the user to select a date and time in an Access application which is used across a network. The application uses Access 2003 as the frontend with SQLServer 2000 as the backend. On most machines (including the one I am developing on) the months and days are correctly displayed in English. However, on some machines the are displaying in German. I thought it may be caused by some machines having...
0
3325
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I would like to get the code for connecting the javascript to asp.net page... Please help me... The javascript code is as follows..
4
3350
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters the comments and clicks the save button then the date and the date will be stored in the mysql database. This is working fine. But my problem is when, after the user had made an entry the date in the calendar for which an entry has made should be...
0
8770
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9442
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9301
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9229
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9176
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6725
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4801
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.