Calendar that selects a date then finds that specific record

Posted on 2006-06-05
Last Modified: 2010-05-18
Another calendar quesiton. I have a calendar form that selects a date. Upon selecting Ok, I am then opening the main form with records. how I go select a date and have the main form open to that record. Within the calendar cmdOk click I have:
    If gtxtCalTarget = Me.txtDate Then
       'do nothing
        gtxtCalTarget = Me.txtDate
    End If
    DoCmd.OpenForm "cDeposits" ', , , "([form!cDeposits.Date]) =#" & [Form]!cDeposits!txtbDATE & "#"""

    DoCmd.Close acForm, Me.Name, acSaveNo

In the main form, the field that recieves the date from the calender is called txtbDate and I would like that to find that specific date record from the table field Date. Help Please
Question by:carlosm06
    LVL 58

    Expert Comment

    Hello carlosm06

    Your sample is confusing. Obviously, txtDate is a control on the current form. gtxtCalTeaget (a globa string variable?) turns out to be also a control, since you can set the focus to it. You then open a form, using as criteria that same form you are opening. Are you in fact re-opening the current form?

    LVL 65

    Accepted Solution

    Syntax wrong?

    when u specify a filter, it has to be the table field name and compare to some value (in this case your calendar value)

    so if your tablefield is called MyDateFld
    u do this

    DoCmd.OpenForm "cDeposits" ', ,  "MyDateFld = #" & gtxtCalTarget & "#"


    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    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 …
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now