This topic is locked

populate field with data fom another

11/20/2008 12:35:03 AM
ASPRunnerPro General questions
G
guroos author

I have 2 fields 'primary contact' & 'stand contact'. I would like when a user populates 'primary contact' that the value is automatically added to 'stand contact' although this would be able to be overwritten if necessary.
I tried some code I found by searching the forum in the 'before record updated' event but it didn't work. Can the second field change when the first one is updated/loses focus or does it have to wait until the record is updated?

G
guroos author 11/21/2008

I tried this in the 'before record updated' event on the add page:

dict("StandContactFirstname")=dict("PrimaryContactFirstName")

and it works.
However if the name is different then it will get overwritten so I need some sort of 'if null' statement so I tried:

if dict("StandContactFirstname") is null then

dict("StandContactFirstname")=dict("PrimaryContactFirstName")

end if
However, I get the following when I try to add the record:

ASP error happened

Technical information

Error number 424

Error description Object required

URL /agmma/2009/t_Applications_add.asp

Solution
Please contact support team and send detailed description of what you doing or your event code.
Again it would be better if this could happen as the focus leaves the first field but I understand that this may be outside the scope of this software.

J
Jane 11/21/2008

Hi,
try to use this one:

if isnull(dict("StandContactFirstname")) then

dict("StandContactFirstname")=dict("PrimaryContactFirstName")

end if

G
guroos author 11/21/2008

that didn't work but this did:

if (dict("StandContactFirstname"))="" then

dict("StandContactFirstname")=dict("PrimaryContactFirstName")

end if