PDA

View Full Version : Find "-n-t" in a string and skip it!



itipu
10-10-2007, 06:20 AM
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

Norie
10-10-2007, 06:31 AM
Mike

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

itipu
10-10-2007, 06:33 AM
Because I am dumping a cn attribute from Active Directory... it just gets all the values....

itipu
10-10-2007, 08:50 AM
Thx

Norie
10-10-2007, 09:01 AM
Mike

Take a look at Instr or Like.

If Instr(objRecordSet.Fields("cn").Value, "-n-t" Then objRecordSet.MoveNext