Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VB Calendar Component Hell

  • 22-02-2005 03: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, Registered Users 2 Posts: 21,278 ✭✭✭✭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,688 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