Results 1 to 7 of 7
  1. #1
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126

    Date query not working

    I have a table of race results (Indy 500) and I want to be able to select a race date from a dropdown list and display the results from that race.

    I have form set up with a query that works if I go into the query and enter the proper date such as #5/29/2016#.

    When I set the query up from the form [Forms]![ResultsByYearF]![RaceYearCmb I get an error that it is typed incorrectly or is too complicated.



    I have not been able to get this to work. I just need to select a single date not a range.

    Jim O
    Last edited by JimO; 06-10-2016 at 01:52 PM.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you missed the last bracket
    [Forms]![ResultsByYearF]![RaceYearCmb]

  3. #3
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126
    Thanks for your response but, I am still getting the same error message. This expression is typed incorrectly or it is too complex to be evaluated.

    Jim O

  4. #4
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,369
    Maybe your year combo row source returns text and not a date? Create (if you don't have it already) an AfterUpdate event on the combo and use this:
    Code:
    If IsDate(Me.RaceYearCmb) then
      msgbox "Is a date"
    Else msgbox "Is not a date"
    End If
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126
    Ok now I get the message Is not a date. How do I fix that?

    Jim O

  6. #6
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126
    It seems to be working now. Thanks to both of you for your time and effort.

    Thanks
    Jim O

  7. #7
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,369
    I've had that error before - usually the cause was forgetting to wrap my dates in #'s but this was because I was concatenating a sql statement in vba. I don't get the impression you were doing that, and the test tells me your combo value is text that looks like a date rather than an actual date data type. What I posted is not a fix, so do not rely on it as it was only intended to tell me if it was a date or not. It makes no sense that it is working now by doing just that. You must have made some other changes?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Date() function not working in query
    By riggsdp in forum Queries
    Replies: 8
    Last Post: 02-05-2015, 02:33 PM
  2. Date query not working
    By wolfm in forum Queries
    Replies: 2
    Last Post: 06-06-2014, 08:39 AM
  3. Changing Date Formats in SQL Query Not Working
    By Markb384 in forum Queries
    Replies: 9
    Last Post: 05-02-2014, 08:55 AM
  4. Replies: 6
    Last Post: 02-28-2013, 05:38 PM
  5. Replies: 3
    Last Post: 09-19-2012, 08:59 AM

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