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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access fields on Form 1

Status
Not open for further replies.

LWB

Technical User
Feb 4, 2003
95
US
I can't seem to figure this one out.

I have a form with many alphanumeric fields displayed (all from one record). I have a button on the form that I want to check the displayed fields for others containing the same value and then change the color of these records. (Actually I want to color the larger box that contains the record, but I need to figure this out first)

My button currently sets up an array containing the fieldNames (arFieldNames)on the form and an array containing the values that are duplicated (arDupNames). Now I need to be able to scan the values of the fieldNames to find those contained in the array. However I can't figure out the right syntax (or datatypes or something) to make this work.

Here is what doesn't work. Can you tell me what does? I know that it is not properly connecting the connecting the names of the fields to the fields themselves. How do I do that?

For i from 1 to arSize
Name = arFieldNames(i).value
if arDupNames.contains(Name) then
arFieldNames(i).color = blue
endIf
endFor

Can anyone help? (I hope I explained this clearly.)
 
LWB,

I'm a bit unclear on the design, for you mentioned records, though described the fields as being from the same record. I'll assume the latter, for it's easier to demonstrate. (Additional work is needed to support multiple records.)

Assuming your field objects have the same names as the underlying fields, something along these lines may help (pseudocode):

Code:
var
   uiTarget  UIObject
   ; ...whatever else is needed
endVar

   ; other stuff to populate the arrays, etc.
   For i from 1 to arSize
      Name = arFieldNames[i].value
      if arDupNames.contains(Name) then
         uiTarget.attach( Name )
         uiTarget.attach( uiTarget.ContainerName )
         uiTarget.Color = blue
      endIf
   endFor[code]

In other words, attach a UIObject variable to attach to the field object and the reattach it to the object that contains it.  Once you've done that, you should be able to provide the visual effect you're looking for.

Hope this helps...

-- Lance
 
Lance,

That's it! You are great.

I had to change one thing in the first attach statement and it worked perfectly (to attach to the field name not the field value).

For i from 1 to arSize
Name = arFieldNames.value
if arDupNames.contains(Name) then
uiTarget.attach(arFieldNames)
uiTarget.attach(uiTarget.ContainerName)
uiTarget.Color = blue
endIf
endFor

Now I just have to make the changes to change the color with each duplicate name. But that should be easy in comparison. I was really getting frustrated.

Thanks,

Lynn

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top