Results 1 to 8 of 8
  1. #1
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232

    calendar control in a query

    I have a query with a field name (date) with a criteria of


    >=[start date] And <=[end date]
    I would like to be able to add a calendar control to select the dates.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    in a form, put 2 text boxes: txtStartDate and txtEndDate
    set the format of the boxes to SHORT DATE,
    now when the user put the cursor in the box, a date picker will appear to the right of the box. (eazy peezy)

    the query will then use:
    select * from table where [date] between forms!myForm!txtStartDate and forms!myForm!txtEndDate

  3. #3
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    Hi Ranman256 , I did what you said and I added the select statement to the query under the field Date in the criteria. I get the following error
    check the subquerys syntax and enclosed the subquery in parentheses

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    no subquery exists. none are needed.
    do NOT do this in sql, use a query, they always get the syntax correct.

  5. #5
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    I have a query with a field date I am putting this in the criteria for that field.
    Is not the correct place.
    I made a form like you said and added the two text box I names the form calendar ( it only has the two text boxed) then I went back to my query and tried to add to the criteria the select statement you said to use. Not sure if I am doing it right

  6. #6
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    Quote Originally Posted by angie View Post
    I have a query with a field date I am putting this in the criteria for that field.
    Is not the correct place.
    I made a form like you said and added the two text box I names the form calendar ( it only has the two text boxed) then I went back to my query and tried to add to the criteria the select statement you said to use. Not sure if I am doing it right
    I got it to work

    between[forms]![calender]![txtstartdate] and [florms]![calendar]![txtenddate]

    put a run query button on the form and it works. Tank you

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Does your date field data include time? If so, Between probably won't work as you expect.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    No, just dates. Thanks

    Quote Originally Posted by Micron View Post
    Does your date field data include time? If so, Between probably won't work as you expect.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. calendar control
    By diwwin in forum Access
    Replies: 1
    Last Post: 03-01-2015, 01:03 PM
  2. Calendar Control
    By angie in forum Forms
    Replies: 19
    Last Post: 06-15-2014, 06:06 AM
  3. Calendar Control
    By senn2912 in forum Access
    Replies: 1
    Last Post: 01-13-2012, 09:09 AM
  4. Run query from calendar control
    By DaveyJ in forum Queries
    Replies: 1
    Last Post: 07-02-2010, 07:54 AM
  5. Access - Calendar Control
    By James890 in forum Forms
    Replies: 3
    Last Post: 04-01-2009, 04:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums