Filter records with Right string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emo10001
    New Member
    • Oct 2007
    • 2

    Filter records with Right string

    Hey everyone,

    New here and fairly new to Access programming. I'm using Access 2003 in XP SP2 I've used this site before without having to ask a question but I'm really stuck :(

    I have a table that I need to filter with the "on click" of a form button. The table has a column called "partnum" (part number). The part numbers are divided with a dash, and then part catagories are broken down with a number range, i.e. all "1000" parts are incoming, all "2000" parts are winding...etc. The part number format is:

    XXXXXX-1XXX (for incoming)
    XXXXXX-2XXX (for winding)...etc

    I need to filter out all "1000" part types. I understand the concept of using me.filter and then having a string that takes the right 4 numbers and showing only the parts greater than "1999", but I have no idea what the syntax would be other than starting with "me.filter" and then after the string having "me.filter = true" (I think).

    Then, I need a button that would show only parts within a certain range. As in showing all "3000" parts...etc

    *sigh* I told them I new very little about VBA...hehe...bu t I guess I'm learning as I go...trial by fire!

    Any help would be greatly appreciated :)

    Thanks

    emo10001
  • emo10001
    New Member
    • Oct 2007
    • 2

    #2
    Well I finally got it. So if anyone runs into a similar situation, heres the code found to work:

    Me.Filter = "right([partno],4)>1999"
    Me.FilterOn = True

    (oh, and I figured out that it was partno, not partnum)

    Also for the n00bs like me. Always remember that you can do most things in the form properties. How I really figured this out was putting my cursor in the "filter" of the partno properties box and hitting F1 for more info.

    Comment

    • mlcampeau
      Recognized Expert Contributor
      • Jul 2007
      • 296

      #3
      Originally posted by emo10001
      Well I finally got it. So if anyone runs into a similar situation, heres the code found to work:

      Me.Filter = "right([partno],4)>1999"
      Me.FilterOn = True

      (oh, and I figured out that it was partno, not partnum)

      Also for the n00bs like me. Always remember that you can do most things in the form properties. How I really figured this out was putting my cursor in the "filter" of the partno properties box and hitting F1 for more info.
      Glad you got it figured out. Thanks for posting your solution!

      Comment

      Working...