Solved

Calendar Advice

Posted on 2004-09-08
8
421 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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.

786 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