Solved

Calendars with subforms

Posted on 2002-03-13
4
474 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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 different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

688 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