Solved

Calendars with subforms

Posted on 2002-03-13
4
467 Views
Last Modified: 2010-05-18
Hi

I'm using MSAccess 97.

I have a form which contains a subform that shows lists of appointments made. I want a calendar on my form that when a date is picked the subform will display all the appointments for that date.

Please help!
0
Comment
Question by:vlovato
  • 2
  • 2
4 Comments
 

Expert Comment

by:mad3654
ID: 6861945
vlovato,

create a Module named "bascalendar"
Enter the following lines

Option Compare Database
Option Explicit

Const adhcCalendarForm = "frmCalendar"
---------------------------------------------------------
Function adhDoCalendar(Optional varPassedDate As Variant) As Variant
   
       
    ' From Access 97 Developer's Handbook
    ' by Litwin, Getz, and Gilbert (Sybex)
    ' Copyright 1997.  All rights reserved.
    '
    Dim varStartDate As Variant


    varStartDate = IIf(IsMissing(varPassedDate), _
    Date, varPassedDate)

    If Not IsDate(varStartDate) Then varStartDate = Date
   DoCmd.OpenForm FormName:=adhcCalendarForm, _
   WindowMode:=acDialog, OpenArgs:=varStartDate
     If isOpen(adhcCalendarForm) Then
        adhDoCalendar = Forms(adhcCalendarForm).Value
        DoCmd.Close acForm, adhcCalendarForm
    Else
        adhDoCalendar = Null
    End If
End Function
---------------------------------------------------------
Put an unbound TxtBox and name it "Date" in the form and make the child link and master link of the subform to the txtbox(Date).
Child Link = date
Master Link = date

I put a button on the form with the following code at the On_Click properties

Private Sub Button_Click()
Me!Date = adhDoCalendar((Me!Date))
End Function

I have a canendar form named "frmcalendar"
When you click the button it opens the form "frmcalendar".
When you click on a date, it updates the "Date" txtbox that is linked to the subform.  This should show you the list of Appts for that date.

Hope this helps
You can try adding an Activex control in the form using the same idea. You won't need the modual.

mad
P.s. I can e-mail this sample data base to you if you wish.


0
 

Author Comment

by:vlovato
ID: 6863853
Thanks mad!
Would be grateful if you would email the db to me. Am feeling confused!
(v_lovato@hotmail.com)
V
0
 

Author Comment

by:vlovato
ID: 6863854
Thanks mad!
Would be grateful if you would email the db to me. Am feeling confused!
(v_lovato@hotmail.com)
V
0
 

Accepted Solution

by:
mad3654 earned 100 total points
ID: 6879823
vlovato,
Check out this question if you would like to put the calendar as a subform.


nic5038

http://www.experts-exchange.com/msaccess/Q.20278347.html
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now