Hi James,
You have to double dots because the first dot denotes the end of the macro substitution.
ThisForm.&lcUpdateCity..Value = ZipCity.LwrCity
ThisForm.&lcUpdateState..Value = ZipCity.State
>Hi All,
>
>I've seen this done somewhere before but I can't seem to put 1 and 1 together. How do you reference an object using the value of a variable? I'm kind of recalling something like double-dots ThisForm..cControlName.Value..??? I'm not really sure.
>
>Here's some background of what I'm trying to do. I have two address blocks on my form, one for the mailing address and one for the residence address (they may be different). I have a simple method that looks up the city and state based on the zipcode provided. I want to pass the method either "MAIL" or "RES" to determine which controls to update the residence or mail.
>
>Thanks in advance for all your help.
>
>Aloha,
>
>James
>
>Here's a sample of what the code looks like:
>************************************************************
>** ZipLookup(96792, "MAIL")
>************************************************************
>
>LParameters tcZip, tcResOrMail
>
>Local lcCity, lcState, lnOldArea
>
>lcCity = ""
>lcState = ""
>lnOldArea = Select()
>
>Select ZipCity
>Locate for Zip = tcZip
>If Found()
> lcUpdateCity = "txt" + tcResorMail
>
> *!* Here's where my prolem is
> *!* This doesn't work and I can't remember what will
> ThisForm.&lcUpdateCity.Value = ZipCity.LwrCity
> ThisForm.&lcUpdateState.Value = ZipCity.State
>EndIf
>
>Select (lnOldArea)
>
--sb--