Consulting

Results 1 to 5 of 5

Thread: Find "-n-t" in a string and skip it!

  1. #1
    VBAX Contributor
    Joined
    Feb 2007
    Posts
    126
    Location

    Cool Find "-n-t" in a string and skip it!

    Hi, I am dumping some stuff from AD, and would like to skip some records if their value contains "-n-t".

    The line below gives a string value...

    objRecordSet.Fields("cn").Value

    I want to say something like:

    If objRecordSet.Fields("cn").Value contains "-n-t" then
    objRecordSet.MoveNext

    Just not sure how to get to "-n-t"... Records are of variable length so left, mid or right wont work!

    Thx a lot

    Mike

  2. #2
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Mike

    Couldn't you just use that in criteria for the recordset?

  3. #3
    VBAX Contributor
    Joined
    Feb 2007
    Posts
    126
    Location

    Not really

    Because I am dumping a cn attribute from Active Directory... it just gets all the values....

  4. #4
    VBAX Contributor
    Joined
    Feb 2007
    Posts
    126
    Location

    Any suggestions please???

    Thx

  5. #5
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Mike

    Take a look at Instr or Like.
    [vba]
    If Instr(objRecordSet.Fields("cn").Value, "-n-t" Then objRecordSet.MoveNext[/vba]

Posting Permissions

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