Using field content as field name

Good Morning,

I have a document that holds values for different functions with the database. Two of the fields contain field names on a form in another database.

My question, how can I incorporate the contents in these fields in an agent that pulls the information from the other database? I tried using the following code but get a type mismatch:

serialnumber$ = mig_doc.GetItemValue(admin_doc.serialnumberfield(0))

I’m thinking I get the type mismatch because the field name used in the GetItemValue function must be in quotes which pulling the field name from the admin_doc may not be providing.

Any input on how I can do this would greatly be appreciated.

Subject: Using field content as field name

I think you’re looking at the error message incorrectly. notesdocument.GetItemValue returns an array, and you’re trying to make it a string. Try thins instead :

dim answer as Variant

answer = mig_doc.GetItemValue(admin_doc.serialnumberfield(0))

serialnumber$ = answer(0)

Subject: RE: Using field content as field name

That worked perfectly.

Thanks Rampisad!