Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jul 2002
    Thanked 0 Times in 0 Posts

    open a query from calendar (Access 2000)

    Open a query from calendar

    I have a calendar with a separate command button called cmdOK.How can i open a query containing field OrderDate in the table orders,
    as order.orderdate depending on the date chosen?Shall i write an sql or just the query will be enough?

    Private Sub cmdOK_Click()
    ' Just hide the calendar form. This makes it possible for the caller
    ' to get at the date that was chosen.
    Dim var As Variant
    var = SelectDate(strSelected)
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: open a query from calendar (Access 2000)

    You can refer to the value of the calendar control in a query.

    If you want to select all records for which OrderDate is equal to the selected date, put something like the following in the criteria row under OrderDate in the query grid:


    where frmMyForm is the name of the form, and actCalendar is the name of the Calendar control.

    If you want to open another form, or a report, and restrict it to records with OrderDate equal to the selected date, you don't need to do this in the query. You can pass a WhereCondition in the OpenForm or OpenReport method:

    DoCmd.OpenForm FormName:="frmOtherForm", WhereCondition:="OrderDate=Forms!frmMyForm!actCale ndar"


    DoCmd.OpenReport ReportName="rptMyReport", View:=acViewPreview, WhereCondition:="OrderDate=Forms!frmMyForm!actCale ndar"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts