Results 1 to 5 of 5
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    formating issues


    All, using access 2003 frontend w/sql server 2008 backend. I am running a query. Some of the date fields are formatted so they would appear in the result as mmddyy and mmmmyyyy instead of SQLs yyyymmdd. This runs fine and returns the records until I want to put a parameter on the date: between[enter start date] and [enter end date]. Then when I run it; no records are returned. Can someone tell me why this is happening?
    Thanks

  2. #2
    jameslarsen is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Location
    Los Angeles, CA
    Posts
    20
    Since it sounds like the formatted dates are actually being returned as strings, have you tried converting the string back to an appropriately formatted date using CDate() in your between function? For example:

    between CDate([enter start date]) and CDate([enter end date])

    Let me know if that helps.

    James A. Larsen
    Database Architect, Data Analyst, and Business Intelligence Specialist
    james.larsen42@gmail.com

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Thank you for replying. This did not work.

  4. #4
    jameslarsen is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Location
    Los Angeles, CA
    Posts
    20
    Can you try to expand on what is happening during your queries? So you are sending a command from Access to SQL Server to retrieve some dates. Where are you putting these dates once they are first returned to Access? A combo box? When you use your between function, are you running it inside Access with the local results pulled down from SQL Server? Or are you sending the query back to SQL Server for new results? You will definitely need some kind of conversion to force the date as it is displaying in Access into a format that the query will recognize as a date. I am fairly certain your problem is just that you are providing a string in your query when it is expecting a date, so it can't figure out what you want.

    James A. Larsen
    Database Architect, Data Analyst, and Business Intelligence Specialist
    james.larsen42@gmail.com

  5. #5
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Resolved. I had to take the formatting to the parameter:

    Code:
    Between Format([ENTER START DATE],"mmmm yyyy") And Format([ENTER END DATE],"mmmm yyyy")
    This worked. Thanks for your help.

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

Similar Threads

  1. Conditional Formating help
    By Mounds in forum Forms
    Replies: 2
    Last Post: 02-10-2012, 11:07 AM
  2. Formating Textboxes
    By desibabu90 in forum Forms
    Replies: 6
    Last Post: 08-02-2011, 07:48 AM
  3. formating field
    By slimjen in forum Access
    Replies: 9
    Last Post: 01-11-2011, 04:46 PM
  4. Formating string
    By Alex Motilal in forum Reports
    Replies: 7
    Last Post: 12-10-2010, 06:09 AM
  5. Querry formating
    By Zoroxeus in forum Queries
    Replies: 0
    Last Post: 03-07-2006, 11:00 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