George said:
Hello everybody again,
I need to create a form like the one built in MS-Outlook to record
appointments.
Is there any way to do that - Create such a form and record appointments
within a database?
Thanking yoy in advance,
George (
[email protected])
I needed to do something similar for a database, where we wanted a group
calendar separate from everyone's Outlook calendars. There's probably a
clever way to do this better with some ActiveX control, but it worked for me:
Lay out your Calendar Form with boxes for dates, little boxes for the day
numbers, and headings for week days. Add 30+ labels that fit in the big
boxes; these are going to be your appointments. Give each of these a name
you can remember, numbered sequentially. For example, my controls are
BoxMon1, BoxTue1, BoxWed1 through BoxSun6; LabelMon1 through LabelSun6; and
Appt1 through Appt60.
You'll need a function that labels the days of the calendar. I use
"LabelMon1.Caption = Day(FirstDate): LabelTue1.Caption = Day(FirstDate+1)..."
You'll need another function that creates the appointments. Loop through
all the appointments in your DB that start <= the last day showing, and end
= the first day showing. For each one, grab the next ApptX label, position
it on the correct day programmatically (you'll need to keep track of how many
Appts you've assigned to each day-box). Set the ApptX caption to the
appointment's time and name. Set Visible = False for any unused Appts.
I've added a little more; it color-codes months, highlights the current day,
automatically adds people's names, handles multiple-day appointments, etc.
If this seems a little overwhelming, please see this screen shot:
http://www.tmscontracting.com/Images/Calendar.gif. I'd be glad to share the
schema and source code.
Of course, all this may be overkill! You can make something much simpler in
the form of a list of appointments, with a blank line and a label each time
the day changes. Like this:
-----Monday-----
10:00: Boss get his shoes shined
3:00: Fred doctor's appt
4:00: Staff meeting
-----Tuesday-----
8:30: Bob doctor's appt
12:00 Boss lunch with headhunter
If that's good enough for your needs, you can get by with a simple
Appointments table, query it for >= Now(), and (if you're using Access 2003)
insert extra lines after the fact.