How do you get outlook to recognize a custom field within some VBScript?

Here's the situation... I have a outlook custom form, mainly run by a vbscript.  I'm trying to add a custom textbox field into the code.  I understand how to add the field to the form.. and how to add it into the code.  However, because outlook 98 works the beautiful (ahem) way it does, the custom field needs to be defined within the code in some shape, way or form.  As you can see here....


Set dao = Application.CreateObject("DAO.DBEngine.35")
      Set dao = DAO.Workspaces(0)
      Set dbs = dao.OpenDatabase(strDBName)
      Set rst = dbs.OpenRecordset("tblContacts")
      rst.AddNew
      If Item.Title <> "" Then rst.Title = Item.Title
      If FirstName <> "" Then rst.FirstName = FirstName
      If Item.MiddleName <> "" Then rst.MiddleName = Item.MiddleName
      If Item.LastName <> "" Then rst.LastName = Item.LastName
      If Item.Suffix <> "" Then rst.Suffix = Item.Suffix
      If Item.ScreenPass <> "" Then rst.ScreenPass = Item.ScreenPass


Here is a small cut of the code...  The ScreenPass is a custom item.  I'm just trying to finally get the object to recognized the method/property so that is will export the info to the database... just like it does for all the microsoft predefined fields.

Like i said... it all works fine until the custom field...  any ideas?
KimLoveringAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SMosherCommented:
You need to use the UserProperties collection to access custom properties:

Item.UserProperties("ScreenPass").Value
0
KimLoveringAuthor Commented:
I keep getting an Argument not Optional error...  is there something else I can add in?  I've tried other ways to add in the item and I've had no luck... But this one makes much more sense...  have any suggestions?
0
SMosherCommented:
What does your code look like now, when modified ot use the UserProperties collection?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

KimLoveringAuthor Commented:
Item.UserProperties("ScreenPass").Value

      'Pick up path to Documents folder from Registry
      Set objWord = Item.Application.CreateObject("Word.Application")
      strDocsDir = objWord.System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Personal")
      strDBName = strDocsDir & "\Code\Personal.mdb"
      MsgBox "DBName: " & strDBName
      objWord.Quit
      Set dao = Application.CreateObject("DAO.DBEngine.35")
      Set dao = DAO.Workspaces(0)
      Set dbs = dao.OpenDatabase(strDBName)
      Set rst = dbs.OpenRecordset("tblContacts")
      rst.AddNew
      If Item.Title <> "" Then rst.Title = Item.Title
      If Item.FirstName <> "" Then rst.FirstName = Item.FirstName
      If Item.MiddleName <> "" Then rst.MiddleName = Item.MiddleName
      If Item.LastName <> "" Then rst.LastName = Item.LastName
      If Item.Suffix <> "" Then rst.Suffix = Item.Suffix
      If Item.ScreenPass <> "" Then rst.ScreenPass = Item.ScreenPass


That's what i have... I've played with it a little... but nothing worked... so this is the original statement that gives the error... I'm sure I'm looking over the obvious...
0
SMosherCommented:
Did you try

If Item.UserProperties("ScreenPass").Value  <> "" Then rst.ScreenPass = Item.UserProperties("ScreenPass").Value ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KimLoveringAuthor Commented:
There ya go!  Sorry.. bit slow.. first time using VBScript...  Thanks a million!

 ...Send me a reply so i can give you your points...

appreciate it!!
0
KimLoveringAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.