Solved

Calendars with subforms

Posted on 2002-03-13
4
471 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

829 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