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!

Filling a field depending on the contents off another field

Status
Not open for further replies.

wimek

IS-IT--Management
Jul 4, 2002
4
GB
Hi,
I have a database containing 2 fields, I want to fill fieldA depending on the content of fieldB.
Can anybody help this newbie with the script syntax for this

Thanks

Wim
 
Hi Wim,

do you want to auto-fill fieldA depending on fieldb? If yes, look at my example:

I use two fields, fieldB is the Salutation, fieldA is the SalutationString which should be used as title in a Form Letter. SalutationString should be auto-filled with "Dear Mr." if Salutation contains "Mr.", with "Dear Ms." if Salutation is "Ms." and with "Dear Sir or Madam" if Salutation is blank.

To do this, open the Field Definition dialog, click on SalutationString (in your case fieldA)and open the Option Dialog. In the Option Dialog box DefaultValue check the Modification Formula Radio Button and then press the Formula Button.
Now you can enter the Formula:

If(Salutation = 'Mr.'; 'Dear Mr.'; If(Salutation = 'Ms.'; 'Dear Ms.';'Dear Sir or Madame'))

You can do that manually or by using the Formula Assistent. The assistant is helpful, because you will see the syntax of the choosen funktion in the bottom line Formula dialog.

Hope it works,

Lu
 
Lukni, thanks, Im getting further, but not all the way.
Let me try to explain:
I have a database with 2 fields.
FieldA and FieldB
The pseudo coding is:

while there are DBrecords
read DB record
if Field B pos 1-3 contains "ace"
then Field B = "ACME"
end while

 
Hi Wim,

to do a while funktion on a record set you can create a looping macro. You can find a short disciption how to create a looping macro in the Approach help. Keyword is "Sample macro procedures".

Lu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top