Results 1 to 8 of 8

Thread: Acc 2003 - Forms - Problem in transferring Dates, to query

  1. #1
    Join Date
    Aug 2008
    Posts
    29

    Question Acc 2003 - Forms - Problem in transferring Dates, to query

    Hi
    I have the below query to retrieve dates from a form named frmCaseHearingDatesRange to populate a query named QryPARAMCasesListedRangeFORM
    Code:
    SELECT QryCounselCaseLatestStage.counselName, QryCounselCaseLatestStage.partyNames, QryCounselCaseLatestStage.[Next Date], QryCounselCaseLatestStage.caseStage, QryCounselCaseLatestStage.remarks
    FROM QryCounselCaseLatestStage
    WHERE (((QryCounselCaseLatestStage.[Next Date]) Between [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgFrom] And [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgTo]));
    The above code has two problems:
    • if the dates are diff it does not pick up the records from the From date
    • if the dates are same in both the DTPs no record is displayed

    Could someone help..

  2. #2
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275
    When using SQL the date must in the format mm/dd/yyyy

    Try this code

    Between & "#" & Format([Forms]![frmCaseHearingDatesRange]![DTPDateOfHgFrom], "mm/dd/yyyy") & "#" & And [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgTo], "mm/dd/yyyy") & "#" &));
    Allan

  3. #3
    Join Date
    Mar 2006
    Location
    Oklahoma City, OK
    Posts
    184
    Quote Originally Posted by Ignorant View Post
    Hi
    I have the below query to retrieve dates from a form named frmCaseHearingDatesRange to populate a query named QryPARAMCasesListedRangeFORM
    Code:
    SELECT QryCounselCaseLatestStage.counselName, QryCounselCaseLatestStage.partyNames, QryCounselCaseLatestStage.[Next Date], QryCounselCaseLatestStage.caseStage, QryCounselCaseLatestStage.remarks
    FROM QryCounselCaseLatestStage
    WHERE (((QryCounselCaseLatestStage.[Next Date]) Between [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgFrom] And [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgTo]));
    The above code has two problems:
    • if the dates are diff it does not pick up the records from the From date
    • if the dates are same in both the DTPs no record is displayed

    Could someone help..

    Sounds like you might be storing the time with the date in the field QryCounselCaseLatestStage.[Next Date]

    If this is true try this:

    SELECT QryCounselCaseLatestStage.counselName, QryCounselCaseLatestStage.partyNames, QryCounselCaseLatestStage.[Next Date], QryCounselCaseLatestStage.caseStage, QryCounselCaseLatestStage.remarks
    FROM QryCounselCaseLatestStage
    WHERE (((DateValue(QryCounselCaseLatestStage.[Next Date])) Between [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgFrom] And [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgTo]));
    Boyd Trimmell aka HiTech Coach
    Microsoft MVP - Access Expert
    [SIGPIC][/SIGPIC]
    Office Programming 25+ years as a Software Developer specializing in:
    Business Process Management
    Accounting/Inventory Control
    Customer Relations Management (CRM)
    Electronic Data Interchange (EDI)

  4. #4
    Join Date
    Aug 2008
    Posts
    29

    Question

    Thanks HiTech I copy pasted your code...
    Code:
    SELECT QryCounselCaseLatestStage.counselName, QryCounselCaseLatestStage.partyNames, QryCounselCaseLatestStage.[Next Date], QryCounselCaseLatestStage.caseStage, QryCounselCaseLatestStage.remarks
    FROM QryCounselCaseLatestStage
    WHERE (((DateValue(QryCounselCaseLatestStage.[Next Date])) Between [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgFrom] And [Forms]![frmCaseHearingDatesRange]![DTPDateOfHgTo]));
    but still the same result..

    Sounds like you might be storing the time with the date in the field QryCounselCaseLatestStage.[Next Date]
    I cannot say b'cos its a query from another query. however in the base table the date field is set to short date (earlier it was General date)

  5. #5
    Join Date
    Mar 2006
    Location
    Oklahoma City, OK
    Posts
    184
    Quote Originally Posted by Ignorant View Post
    I cannot say b'cos its a query from another query. however in the base table the date field is set to short date (earlier it was General date)

    Shrt date and General date are display formats. Note: data can still be stored date with ime data even is the display format is set to Short date.


    Maybe this example will help: Report Dialog Examples
    Boyd Trimmell aka HiTech Coach
    Microsoft MVP - Access Expert
    [SIGPIC][/SIGPIC]
    Office Programming 25+ years as a Software Developer specializing in:
    Business Process Management
    Accounting/Inventory Control
    Customer Relations Management (CRM)
    Electronic Data Interchange (EDI)

  6. #6
    Join Date
    Aug 2008
    Posts
    29

    Exclamation

    Shrt date and General date are display formats. Note: data can still be stored date with ime data even is the display format is set to Short date.
    Oh that's a news to me..
    Ok how to store date only in a date/time field. Note at this moment the date is being directly entered into the table...

  7. #7
    Join Date
    Mar 2006
    Location
    Oklahoma City, OK
    Posts
    184
    Did you get a chance to look at the example in the link I posted?
    Boyd Trimmell aka HiTech Coach
    Microsoft MVP - Access Expert
    [SIGPIC][/SIGPIC]
    Office Programming 25+ years as a Software Developer specializing in:
    Business Process Management
    Accounting/Inventory Control
    Customer Relations Management (CRM)
    Electronic Data Interchange (EDI)

  8. #8
    Join Date
    Aug 2008
    Posts
    29

    Exclamation

    I surely did, and still scrambling how things are being processed.
    May be you could show me where to look for

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •