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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calendar control with current date 4

Status
Not open for further replies.

kevin531

Technical User
Sep 25, 2002
33
0
0
US
hello, i have an active x calendar control that when a date is selected, if populates a field. what i want it to do is when the calendar control pops up, i want it do display the current date. if it does this then the user wouldn't have to select the month and year to keep it updated. i've tried setting all the properties but that doesn't help. any help would be great. thanks.

-Kevin531
 
In the On Load event of the form add

Private Sub Form_Load()
Me!SelectDate = Date
End Sub

where SelectDate is the name of your Active X control.


David
 
Sorry, i just tried that and it didn't work.
-Kevin531
 
I tried that command and could not get it to work either. Must be something else Regards

Paul
 
In a slight variation in what DJN does - in both Acc 97 and Acc 2K I use:

Me.SelectDate.Value = Date

and it works fine for me.
 
Do you have to set something in the properties for the value as I keep getting the error message

Invalid property value and when I debug it takes me to


Me.DTPicker.Value = Date


Regards

Paul
 
If its the ActiveX control from Microsoft on form load
[ActiveXname].Today
 
Pardon my asking but what ActiveX control is used for the form field to display today's date?
 
Can i rephrase the previous question, how did Kevin531 manage to get the date in the ActiveX control to populate the date field?
 
Hi,

I've had such problems using the ActiveX Calendar Control that comes with Access... I've since found a better, simpler, and more attractive solution:

The Sunbaked Calendar by Sunbaked Software

It is a single little FORM (Yes, a regular Access form) that you import into your database - no reference setting (yay!)

If the date field that called it is empty, it will automatically be positioned at the current date, otherwise, it will be positioned at the date that is in the form.

You can call it from any textbox/date control like this:

1. Pick the event to fire it (I like the double-click)
2. Set the Event of the textbox/date control to this code:
Code:
   DoCmd.OpenForm "frmCalendar"
If it is being called from a subform:
Code:
   DoCmd.OpenForm "frmCalendar", , , , , , "SubformName"
3. <optional, but nice> I also set the control's &quot;ControlTip&quot; property to something useful like &quot;Double-click to open Calendar&quot; to clue in the user.

Oh yeah, and its FREE

Heather

 
FANTASTIC STUFF Heather Floyd, it's worked like a charm. Thanks
 
Heather,
Thanks you have saved me so much trouble

&quot; Have A Star&quot; Regards

Paul
 
Heather,

with the subform option what syntax do I use if the subform is a subform of a subform.

I have it working with the subform but not the one embedded in it. I get a 94 invalid use of null error.
 
Hi HFloyd

I have a strange problem. I took your advice and used that Sunbaked Calendar. It worked great! But my database goes on to our network, in a common drive. The whole department accesses it from there. The problem is that when another user tries to use the date function on the form, it takes them to the code page where the code doesn't look anything like what I have entered. If I unhide the database window and try to open the calendar, that won't open either. They get an error message. Do I have to go to each computer to import the calendar? If I call the database up from the same location, why does it work for me and not them?

Inquiring minds want to know.
[Ponder]



 
Hi HFloyd

I have a strange problem. I took your advice and used that Sunbaked Calendar. It worked great! But my database goes on to our network, in a common drive. The whole department accesses it from there. The problem is that when another user tries to use the date function on the form, it takes them to the code page where the code doesn't look anything like what I have entered. If I unhide the database window and try to open the calendar, that won't open either. They get an error message. Do I have to go to each computer to import the calendar? If I call the database up from the same location, why does it work for me and not them?

Inquiring minds want to know.
[Ponder]

Thanks for all the help. I really am learning a lot from this forum.

 
Dear vb4me,

I have never tried to use it on a nested subform. Is there some other way you can set up your form such that it doesn't need to be nested?

I don't think the code was designed to work on nested subforms. If you are VBA handy, you can go into the &quot;frmCalendar&quot; and try fiddling with the code.

Dear SuePee,

I had no trouble implementing the calendar in networked and replicated databases. The only thing I can think of - Do you have linked tables? (Though I don't know why that would be a problem, it's just the only thing I can think of that might screw up a networked database)

If the debug is going to code other than the Calendar code, it's possible that it's not the calendar that is causing the problems. What code does it debug to?

Heather

[yinyang] [yinyang]
 
Hi Heather,

On my computer it shows 'open form frmcalendar', but on the other computers it shows the code associated with the entire frmcalendar. I don't understand why it shows differently on their computers than it is on mine.

[soapbox]
Sorry, sometimes I get soooo frustrated!

 
On the &quot;On Open&quot; event, try this

actX.value=Now()

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top