Consulting

Results 1 to 2 of 2

Thread: Filter DataBase Between Selected Start and End Dates w/ Visual Studio 2012

  1. #1
    VBAX Contributor
    Joined
    Aug 2011
    Posts
    126
    Location

    Filter DataBase Between Selected Start and End Dates w/ Visual Studio 2012

    I entered the following into a Visual Studio Form to Filter the DataBase for entries between a Starting Date and Ending Date.
    The Filter Returns Entries that are Less Than and Equal to the Ending Date (<= DateTimePicker2),
    The Filter Returns Entries that are Greater Than the Start Date (>= DateTimePicker1), However,
    It DOES NOT Return the Entries that are Equal to the Start Date.

    [VBA]MyDataBaseBindingSource.Filter = "Customer= '" & Customer.Text & _
    "' and product= '" & Product.Text & _
    "' and saledate >='" & DateTimePicker1.Value & _
    "' and saledate <= '" & DateTimePicker2.Value & "'"

    [/VBA]

    If I am not in the proper forum, I apologize. Please direct me accordingly.
    Thank you for your assistance.

  2. #2
    VBAX Contributor
    Joined
    Aug 2011
    Posts
    126
    Location
    Quote Originally Posted by Rlb53 View Post
    I entered the following into a Visual Studio Form to Filter the DataBase for entries between a Starting Date and Ending Date.
    The Filter Returns Entries that are Less Than and Equal to the Ending Date (<= DateTimePicker2),
    The Filter Returns Entries that are Greater Than the Start Date (>= DateTimePicker1), However,
    It DOES NOT Return the Entries that are Equal to the Start Date.

    [VBA]MyDataBaseBindingSource.Filter = "Customer= '" & Customer.Text & _
    "' and product= '" & Product.Text & _
    "' and saledate >='" & DateTimePicker1.Value & _
    "' and saledate <= '" & DateTimePicker2.Value & "'"

    [/VBA]

    If I am not in the proper forum, I apologize. Please direct me accordingly.
    Thank you for your assistance.
    I found a Solution:

    [vba]
    MyDataBaseBindingSource.Filter= "Customer= '" & Customer.Text & _
    "' and product= '" & Product.Text & _
    "' and saledate >= '" & DateTimePicker1.Value.AddDays(-1) & _
    " and saledate <= '" & DateTimePicker2.Value & "'"
    [/vba]

Posting Permissions

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