Results 1 to 12 of 12
  1. #1
    Star Lounger
    Join Date
    Nov 2001
    Location
    Wellington, New Zealand
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Odd / Even (XP SP1)

    Sorry this is so basic, I have limited experience with Access (but enough to get into trouble).

    In a query, I want to build an "expression" for a filter - apply one test if a number is odd, and a different one if it is even. eg. I envisage my criteria something like:

    (IsOdd And <test1>) Or (isEven And <test2>)

    But neither "isOdd" nor "Odd" etc are valid operators? Surely this is a common enough issue that there is some simple test for odd / even with out having to do arithmetic? How should I be doing this?

    Also, where in the help do you find info on particular operator such as Imp & Eqv. Searching for those in help yields nothing.

    Plus where do I find a list of allowable functions? I search for functions & get a heap of topics, but none that appears to say "Here is the complete list" (with explanations). Best I found so far is under "About expressions > functions" . All it says is "... Microsoft Access includes many built-in functions; for example:" & it lists Date, Sum & Dlookup ! Fat help.

    Some help here would be much appreciated
    David

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd / Even (XP SP1)

    In answer to the first part of your question, yes I have seen code for Odd / Even, can

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd / Even (XP SP1)

    BTW, you could write your own function to test for odd /even. I think the basic principle of the code I saw was to divide by two if the answer was a whole number then it was even if it had a remainder it was odd.

    You can test for remainder with MOD:

    From Help:::
    Mod Operator Example
    This example uses the Mod operator to divide two numbers and return only the remainder. If either number is a floating-point number, it is first rounded to an integer.
    Dim MyResult
    MyResult = 10 Mod 5 ' Returns 0.
    MyResult = 10 Mod 3 ' Returns 1.
    MyResult = 12 Mod 4.3 ' Returns 0.
    MyResult = 12.6 Mod 5 ' Returns 3.

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd / Even (XP SP1)

    Here

  5. #5
    Star Lounger
    Join Date
    Nov 2001
    Location
    Wellington, New Zealand
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd / Even (XP SP1)

    Robert

    Your assistance most appreciated. Yes "Mod" did the trick.

    I suspected that may have been the function to use (same in Fortran :-) ), but when I searched Help for "Mod" (to find the syntax), the search yielded nothing ! Hence my query re how to find a list of functions available.

    For some reason I have considerable difficulty finding what I want in Access Help. Either it is not well indexed or cross referenced, OR I am doing something wrong (probably lots).

    I would have thought that if there is a function / operator "Mod", then searching for Mod in Help would have quickly yielded the details. Then again, I would have thought I could search for "function" or "operator" & quickly come up with a list of all the options available. Obviously I'm too pampered.

    David

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd / Even (XP SP1)

    <hr>OR I am doing something wrong (probably lots).<hr>
    Dont' blame yourself. Since version 2000 the help files are only good to <img src=/S/toilet.gif border=0 alt=toilet width=24 height=26>.
    In my experience, if you go to the VBE editor, and look there for help, you get better results then in the user interface. But these help files are to be installed. They are not installed by default.
    Francois

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Odd / Even (XP SP1)

    As noted several times before, Access Help in 2000 was a definite step backwards, and 2002 was two more. There is however a new set of help files you can download from the MS web site that are presumably better - one of these days I must do that. In the meantime, I finally resorted to going to Contents in Help, rather than using the Answer Wizard or the index. If you do that and expand it to the second level, go to the "Programming in Visual Basic" topic, expand that and find the "Visual Basic Language Reference" and expand it, you will find a fairly complete list of functions under the "Functions" category. But it doesn't list the MOD function discussed in another thread. Perhaps they assumed we all knew that. On the other hand, if you don't know the name of the function you want to read about, it's a challenge all around, and takes lots of <img src=/S/rtfm.gif border=0 alt=rtfm width=24 height=23>
    Wendell

  8. #8
    Star Lounger
    Join Date
    Nov 2001
    Location
    Wellington, New Zealand
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd / Even (XP SP1)

    Are you referring to XP Help. In my version there is only a "Programming in Access" topic (rather than "Programming in Visual Basic" ). I fully expanded every sub topic but never found any reference to the "Visual Basic Language Reference" or even to "Functions". Does this mean I have not installed the VBA Help (quite possible). I will chase up re the new files.

    Thanks
    David

  9. #9
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Odd / Even (XP SP1)

    I would suspect that is the case if you don't have the VBA Reference displayed.
    Wendell

  10. #10
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd / Even (XP SP1)

    Wendell,
    I found the new help files for Office XP, did you know if there are also a set for Office 2000 ?
    Francois

  11. #11
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Odd / Even (XP SP1)

    Nope - haven't seen them, though they may exist. Or MS may have concluded that since XP is out nobody would need them. <img src=/S/sigh.gif border=0 alt=sigh width=15 height=15>
    Wendell

  12. #12
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd / Even (XP SP1)

    That's real MS politics. <img src=/S/money.gif border=0 alt=money width=17 height=15> <img src=/S/money.gif border=0 alt=money width=17 height=15> and <img src=/S/money.gif border=0 alt=money width=17 height=15>
    Thanks anyway
    Francois

Posting Permissions

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