Solved

Calendar Advice

Posted on 2004-09-08
8
422 Views
Last Modified: 2008-02-01
Hello all. I've recently seen the calendar feature that they have in "Outlook Web Access" and would like to know if there is an add in just like that anywhere that I can incorporate into an Access application. It looks something like a doctor or dentists software. Does anyone know? Thanks, Jordan.
0
Comment
Question by:JordanKingsley
  • 5
  • 3
8 Comments
 

Author Comment

by:JordanKingsley
ID: 12012035
Guess everyone's gone, be back tomorrow.
0
 
LVL 2

Expert Comment

by:lightcross
ID: 12012036
There are several options.
You can use an active x control called "date and time picker".
0
 
LVL 2

Expert Comment

by:lightcross
ID: 12012069
I also use a form called "frmPopUpCal" along with a module that seems to be better.  In this message I included the module code and the form code underneath.  Of course you will still need the calendar form that I can email.  I cannot recall exactly where I got this code from but I think it was from a book called " Access Cookbook"
here is the module:

Option Compare Database
Option Explicit

Private Function IsOpen(strForm As String)
    IsOpen = (SysCmd(acSysCmdGetObjectState, acForm, strForm) > 0)
End Function

Public Function acbGetDate(varDate As Variant) As Variant

    Const acbcCalForm = "frmPopupCal"
   
    ' Open calendar form in dialog mode
    ' passing it the current date using OpenArgs
    DoCmd.OpenForm acbcCalForm, WindowMode:=acDialog, _
     OpenArgs:=Nz(varDate)
   
    ' Check if the form is open; if so return the date
    ' selected in the calendar control and close the
    ' popup calendar form and pass the new date back
    ' to the control. Otherwise, just return a null.
    If IsOpen(acbcCalForm) Then
        acbGetDate = Forms(acbcCalForm).CalDate
        DoCmd.CLOSE acForm, acbcCalForm
    Else
        acbGetDate = Null
    End If
End Function

'the form code looks like this:
Option Compare Database
Option Explicit

Public Property Let CalDate(datDate As Date)
    Me!ocxCal = datDate
End Property

Public Property Get CalDate() As Date
    CalDate = Me!ocxCal
End Property

Private Sub cmdCancel_Click()
    DoCmd.CLOSE acForm, Me.Name
End Sub

Private Sub cmdNextMonth_Click()
    Me!ocxCal.NextMonth
    Me.Repaint
End Sub

Private Sub cmdNextYear_Click()
    Me!ocxCal.NextYear
    Me.Repaint
End Sub

Private Sub cmdOK_Click()
    Me.Visible = False
End Sub

Private Sub cmdPrevMonth_Click()
    Me!ocxCal.PreviousMonth
    Me.Repaint
End Sub

Private Sub cmdPrevYear_Click()
    Me!ocxCal.PreviousYear
    Me.Repaint
End Sub

Private Sub cmdToday_Click()
    Me!ocxCal.Today
End Sub

Private Sub Form_Load()
    Me!ocxCal.Today
    If Not IsNull(Me.OpenArgs) Then
        Me.CalDate = Me.OpenArgs
    End If
End Sub

Private Sub ocxCal_DblClick()
    Call cmdOK_Click
End Sub


0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 2

Expert Comment

by:lightcross
ID: 12012105
On the form you wish to use the calendar you will place this code on a command button.  You will need to have a textbox named "tbDateSubmitted" or change that line of code to match your date textbox(es).

Private Sub cmdDateSubmit_Click()

    Dim ctlDate As TextBox
    Dim varReturn As Variant
   
    '[control name]
    Set ctlDate = Me![tbDateSubmitted]
   
    ' Request date
    varReturn = acbGetDate(ctlDate.value)
   
    ' Only change the value if null is not
    ' returned; otherwise user cancelled
    ' so preserve existing value.
    If Not IsNull(varReturn) Then
        ctlDate = varReturn
    End If
       
End Sub
0
 

Author Comment

by:JordanKingsley
ID: 12018487
Wow lightcross, that looks exactly like what I'm looking for, could you email me the form to "grijordan@sunflower.com", thanks so much.
0
 
LVL 2

Expert Comment

by:lightcross
ID: 12019128
I emailed you a database with form, code, and module you will need to get your calendar up and running.  In case you havent noticed, I usually lock the date textbox so that users must use the calendar command button to enter the date.
0
 

Author Comment

by:JordanKingsley
ID: 12019342
Thanks so much lightcross. The email came but this machine is acting really fishy. After a complete scan I'll open the mdb file and get it running. Can you check back in here in a couple of hours? Thanks again :)
0
 
LVL 2

Accepted Solution

by:
lightcross earned 400 total points
ID: 12019370
sure, it emails me when ever you post.  so i will check back incase you need additional help.  You may need to add references.  Check the vba references within the sample I sent you and add them just to be on the safe side.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

820 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