By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,103 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

Access Calendar

rcollins
100+
P: 234
I have a calendar on my form that inputs the date selected. Right now, the date isn't updated until I click on the date box after selecting the date. Is there a way for me to update as I click on the date>
Dec 21 '06 #1
Share this Question
Share on Google+
16 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I have a calendar on my form that inputs the date selected. Right now, the date isn't updated until I click on the date box after selecting the date. Is there a way for me to update as I click on the date>
In the after update event of the calendar object put a requery on the textbox

Expand|Select|Wrap|Line Numbers
  1. Me.textBoxName.Requery
Mary
Dec 21 '06 #2

rcollins
100+
P: 234
I tried this and it made no difference. Is it because the calendar has On Updated rather than After Update?
Dec 22 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
I tried this and it made no difference. Is it because the calendar has On Updated rather than After Update?
Try the on click event instead
Dec 22 '06 #4

Expert 5K+
P: 8,434
Try the on click event instead
Hi Mary.

Is that version dependent? I just had a look at the Calendar Control 8.0 under Access 2000, and the only events it seems to have are:
  • On Updated
  • On Enter
  • On Exit
  • On Got Focus
  • On Lost Ficus
Would this be because I'm on an old version? Or perhaps some of the events aren't listed in the properties box?
Dec 27 '06 #5

100+
P: 1,646
Hi Mary.

Is that version dependent? I just had a look at the Calendar Control 8.0 under Access 2000, and the only events it seems to have are:
  • On Updated
  • On Enter
  • On Exit
  • On Got Focus
  • On Lost Ficus
Would this be because I'm on an old version? Or perhaps some of the events aren't listed in the properties box?
You are only looking at the property list. All of the normal events can be handled in a code module including the click event
Dec 27 '06 #6

Expert 5K+
P: 8,434
You are only looking at the property list. All of the normal events can be handled in a code module including the click event
Thanks Will, I'll have to try and remember that. Sometimes the differences between "real" VB and VBA can be frustrating.
Dec 27 '06 #7

P: 4
tm2
Would someone explain in a "Dummy" format how to accomplish this? I understand how to program events (in VBA, that is), or at least I thought I did. I wish to requery a list control once the Calendar control has been changed. I saw a post where the events can still be programmed even if they are not available in the property list. Please provide more info.

Thanks
Jan 29 '07 #8

missinglinq
Expert 2.5K+
P: 3,532
Don't have a clue why Access only lists some of the events for comboboxes in the Property Box! To gain access to the others you need to go into the code Editor for your form. At the top are two dropdown boxes. When you initially enter the editor the lefthand box will say "General" and the righthand one will say "Declarations."

Go into the lefthand box and scroll down to the name of the combobox. Once this is selected drop down the righthand box, where find all of the related events, and scroll down to whatever event your interested in. This will take you to the appropriate sub, or somewhere close to it! Doesn't always land right on the mark, so check the name of the sub! This is also how you can quickly navigate to a particular sub within the form's code module.
Jan 29 '07 #9

Expert 5K+
P: 8,434
...This will take you to the appropriate sub, or somewhere close to it! Doesn't always land right on the mark, so check the name of the sub!
Excellent advice, linq. But the highlighted part worries me. Are you saying that your VB sometimes shows the wrong sub?! How can that be?
Jan 29 '07 #10

P: 4
tm2
OHH! That's neat! But you know what's puzzling? I have an ActiveX Calendar control on my form. When a different date is selected, I want a list box to requery without having to move off of the calendar control. How can I capture the "change" of selected date?

[Private Sub CalDate_Click()
Me.CurList.Requery
End Sub]

This doesn't work...
Jan 29 '07 #11

rcollins
100+
P: 234
so i realy apreciate all of the input. I still am learning more with each reply. Which one of these would make my date text box equal what is active on the calendar?
Here are My choices for the calendar
[code]
After Update
Before Update
Click
Double Click Enter
Exit
Got Focus
Key Down
Key Press
Key Up
Lost Focus
New Month
New Year
Updated
[/CODE
Jan 29 '07 #12

Expert 5K+
P: 8,434
so i realy apreciate all of the input. I still am learning more with each reply. Which one of these would make my date text box equal what is active on the calendar?
Here are My choices for the calendar
Expand|Select|Wrap|Line Numbers
  1. After Update
  2. Before Update
  3. Click
  4. Double Click Enter
  5. Exit
  6. Got Focus
  7. Key Down
  8. Key Press 
  9. Key Up
  10. Lost Focus
  11. New Month
  12. New Year
  13. Updated
  14.  
You could research it by placing some code in each event to display the value in the calendar control (and the name of the event, of course). As soon as you find the event which fires at the right time and shows the right value, that's the one you want. Then just place the code there to populate the textbox.
Jan 29 '07 #13

Expert 5K+
P: 8,434
OHH! That's neat! But you know what's puzzling? I have an ActiveX Calendar control on my form. When a different date is selected, I want a list box to requery without having to move off of the calendar control. How can I capture the "change" of selected date?
Expand|Select|Wrap|Line Numbers
  1. Private Sub CalDate_Click()
  2. Me.CurList.Requery
  3. End Sub
What's the source of the listbox items? Perhaps it's being repopulated with the same list.
Jan 29 '07 #14

P: 4
tm2
What's the source of the listbox items? Perhaps it's being repopulated with the same list.

The Source is SQL statement which pulls info based on the date selected in current form. The date has to be selected first before the list is populated.
Jan 29 '07 #15

Expert 5K+
P: 8,434
The Source is SQL statement which pulls info based on the date selected in current form. The date has to be selected first before the list is populated.
Ok. But can you give us more detail on exactly what doesn't work? For instance, does the Click event fire when you expect? And if so, does the calendar show the value you expect?
Jan 29 '07 #16

P: 4
tm2
The Source is SQL statement which pulls info based on the date selected in current form. The date has to be selected first before the list is populated.
I got it! It's the little things that get me sometimes...
I had to "Refresh" the form before the list "Requery". It works perfectly now.

Thanks, Killer!
Jan 29 '07 #17

Post your reply

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