Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB Calendar Component Hell

Options
  • 22-02-2005 3:36pm
    #1
    Closed Accounts Posts: 2,639 ✭✭✭


    alright guys, anyone give me a hand with a slight conundrum here I am having with the calendar component in VB?

    Right here's the deal, in the app I'm developing, I've embedded the calendar to allow the user to click on a date and see the sales for the day etc. number of items sold that day etc. and I query the database like this

    'Displays daily sales information
    strDate = dateDay & "/" & dateMonth & "/" & dateYear
    'Filters the specific date clicked on and its orders
    With adoDay.Recordset
    .Filter = "DispatchDate = '" & strDate & "'"

    Now what I wanna do is filter the whole month and it sales but I seem unable to use the filter to do so, the code I currently have is

    'Executes if monthly view option chosen
    strDate = "/" & dateMonth & "/" & dateYear
    With adoMonth.Recordset
    .Find "DispatchDate Like '*" & strDate & "'"


    ?!?!!
    What's wrong?!


Comments

  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    did you try passing in a percentage instead of an asterisk for the wild card?
    .Find "DispatchDate Like '[B]%[/B]" & strDate & "'"
    

    What type of DB are you using?
    Is this a date field in the database? If so, you should be able to use a date comparison instead of a string comparison.

    e.g. (this is just "pseudo code", for illustration only)
    .Find "Month(DispatchDate) =Month(" & strDate & ")"
    

    Eoin


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Is your date stored as a date or a string in the database ?

    You may want to try greater than/less than conditions e.g.
    startDate = '01' & "/" & dateMonth & "/" & dateYear
    endDate = '31' & "/" & dateMonth & "/" & dateYear
    .Filter "DispatchDate >= '" & startDate & "' AND DispatchDate <= '" & endDate & "'"
    


  • Closed Accounts Posts: 2,639 ✭✭✭Laguna


    Thanks dude, it's the string/date comparison that is causing the error i reckon


Advertisement