Lebans Calendar used more than 1x on form

A

Axess08

I really like Lebans calendar as it is very intuitive and user friendly. That
being said I can't figure out how to get it to work for what I am doing.
(Although I have it working for 1 text box.) I have a form that records
follow-up appointment dates (up to 3 different dates - 5 month, 15 month, 21
month) for each patient record. I would like to use the calendar basically 3
times on 1 form to pick a a different date for each text box or combobox.
Does that mean I have to call up 3 different versions of Lebans calendar?
(Can I even do that?)

I know I could autopopulate the 2nd and 3rd box with the appropriate month
based off of the 5th month box but the dates are never exact and have been
known to be off a day or even a month which means that I need the ability to
choose a different day/month after an autopopulation.

Any Suggestions?
 
J

Jim Burke in Novi

I've never used the Lebans calendar, I just use the 'standard' Access
calendar control, but here's what I do when I have more that one text box
that requires a date. I have a variable I use that keeps track of which date
(i.e. textbox) is being updated - when you click on that textbox, that beomes
the 'current' field. Then, in the calendar's AfterUpdate event, I check to
see which textbox is the currrent one and update the appropriate textbox with
the selected calendar value. I put a label above the calendar that shows
which date is the current one. Each date textbox has an on-click event that
sets the current field to that textbox name and sets the calendar label's
caption. Hope that makes sense - works well for me.
 
D

dymondjack

Can you not just add the button/dblclick code to various controls on the form?



Private Sub txtSelectDate_DblClick(Cancel As Integer)

Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date

dtStart = Nz(Me.txtSelectDate.Value, 0)
dtEnd = 0

blRet = ShowMonthCalendar(mc, dtStart, dtEnd)
If blRet = True Then
Me.txtSelectDate = dtStart
Else
' Add any message here if you want to
' inform the user that no date was selected
End If

End Sub




I havent tested it, but I would think that you can use this code repeatedly
in for different controls. The code uses the mc class that's set on the form
load, but the only place that it corresponds to a control is in the control's
event. I think you should be able to use the above code for a number of
controls on the same form without interference.

hth

--
Jack Leach
www.tristatemachine.com

- "Success is the ability to go from one failure to another with no loss of
enthusiasm." - Sir Winston Churchill
 
A

Axess08

I'm sorry it took me so long to reply. I was testing out the code for the On
DoubleClick Event procedure. I had already used this property before I
posted, but I guess that I must have mistyped something originally. Thank
you for your help. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top