Results 1 to 12 of 12
  1. #1
    Join Date
    Nov 2003
    Posts
    18

    Unanswered: -

    -
    Last edited by TheGame7; 11-26-03 at 09:10.

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    It might be a bit like using a sledgehammer to buff out a scratch on a wine glass, but I used the following to accomplish what you are looking for:

    IIf(TimeValue([Time])<TimeSerial(15,0,0),40,50)
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    check out the intrinsic function
    weekday(anyDate, vbSunday) 'or vbMonday etc depending what you want as day 1 of the week

    izy
    currently using SS 2008R2

  4. #4
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91
    Originally posted by izyrider
    check out the intrinsic function
    weekday(anyDate, vbSunday) 'or vbMonday etc depending what you want as day 1 of the week

    izy

    Avoid using iif() statement.


    See this page: http://msdn.microsoft.com/library/de...asp?frmae=true
    My environment: Windows XP/ Access 2000 - Using Microsoft DAO 3.6 Library

  5. #5
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Nothing wrong with using the IIf expression in this case. If you were racing one query against another, you might want to find a different way, but if you can actually wait the extra 2000 milliseconds IIf takes, it is a very useful function, IMHO.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  6. #6
    Join Date
    Oct 2003
    Location
    São Paulo - Brazil
    Posts
    91
    Originally posted by HomerBoo
    Nothing wrong with using the IIf expression in this case. If you were racing one query against another, you might want to find a different way, but if you can actually wait the extra 2000 milliseconds IIf takes, it is a very useful function, IMHO.
    OK. Forget about what Microsoft says.
    My environment: Windows XP/ Access 2000 - Using Microsoft DAO 3.6 Library

  7. #7
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    I usually do forget what M$ says, they only have good stuff about 40% of the time on MSDN, and the link is for a Sybex which I own, incidentally.

    You're trading off a little processor use for flexibility, and the time to redraw the screen is usu a larger bottleneck than a standard function. Again, IMHO.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    iif(weekday(yourDate, vbSaturday) < 3, itIsSatOrSun, itIsMonThruFri)

    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    try it

    weekday() is an intrinsic function in access

    it returns a number (the day of the week 1,2,3,4,5,6 or 7) with day=1 defined by the constant in the second argument (in my example vbSaturday so saturday=1, sunday=2 etc) <3 is true for sat/sun

    price = iif(weekday(yourDate, vbSaturday) < 3, 40, XYZ)
    sets the price to £40 on Sat/Sun based on the date yourDate, and XYZ if yourDate is monday thru friday

    replace XYZ by whatever you are using to fix the time switch on weekdays. for example if the code from Homerboo earlier in this discussion works for you, use

    price = iif(weekday(yourDate, vbSaturday) < 3, 40, IIf(TimeValue([Time])<TimeSerial(15,0,0),40,50))

    ! izy
    currently using SS 2008R2

  10. #10
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    vbSaturday is supposed to be an intrinsic date constant... it is in my installation.

    it has a value = 7 so try replacing:
    ,[vbSaturday])<

    with:
    , 7)<


    izy
    currently using SS 2008R2

  11. #11
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    phew! izy
    currently using SS 2008R2

  12. #12
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326

    Talking

    You can always trust the dogs! LOL
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

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