• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Calendar that selects a date then finds that specific record

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
1 Solution
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?

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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now