Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Sintax in VB Script inside Outlook Form

Status
Not open for further replies.

Grippen

Technical User
Sep 3, 2001
24
GB
Hi,

I'm having problems with VB SCript Sintax with using "Restrict" function.

I get the following script working fine....


Set myItems = oCurrentFolder.Items
Set myRestrictItems = myItems.Restrict ("[Op Title] = 'Fred'")
For Each myItem In myRestrictItems
myItem.Display
Next

But I want to replace 'Fred' with the value of a user defined field called "Customer".

I've tried all sorts of variations around...

Set oTitle = item.userproperties.find("Customer")
Set myRestrictItems = myItems.Restrict ("[Op Title] = oTitle")

What am I missing???

Thanks
 
if not already dimensioned, then dimension customer as a string

and lose the quotes, also you may have to use the trim function to get rid of any leading or trailing spaces in the variable
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top