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

Please help: Pop up calendar

Status
Not open for further replies.

doreenk

Vendor
Aug 5, 2003
4
NZ
I have a pop up calendar attached to my data entry form. I would like to standadised my date entry to every Sunday. How can I modify the calendar so that only Sunday can be selected?

You help is greatly appreciated
 
use a WHERE day(MyDate) = 7

I think Sunday is a '7' CHeck the Help file to be sure.


Rollie E
 
You could use the VeforeUpdate event to modify the value of the calendar to the first day of week (which you set to Sunday. Trial code (ActiveXCtl6 is the Calendar object):
Code:
Private Sub ActiveXCtl6_BeforeUpdate(Cancel As Integer)
    Dim v
    Dim wk As Integer
    With ActiveXCtl6
        v = .Value
        wk = WeekDay(v, vbSunday)
        v = v - wk + 1
        .Value = v
    End With
End Sub
 
Thanks for the tip, but I am not sure how to incorporate this code into the following code I used to transfer the date chosen in the calendar to the date field (which is WeekEnding). I tried to put if after the 2nd line but didn't work.

Private Sub Calendar_Click()

WeekEnding.Value = Calendar.Value
WeekEnding.SetFocus
Calendar.Visible = False

End Sub

Sorry for being such a pain, but I have little knowledge in programming.
 
It works! Thank you very much VBOnly. You are my life saver.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top