View Full Version : Choosing different records and filling in missing information


Hemish
09-28-2007, 04:04 AM
I am trying to add text from one field from another field in ms access 2000 using VBA.

Basically i have a table called tblLetters, with field names as
LetterId (Number)
Letter (Memo)
Name (Text)
Address (Memo)
Postcode (Text)

For the field letter i have differet templates eg

Letter Id 1

Dear xxxxx (name)

Thankyou for your call.

Letter ID 2

Dear xxxx (name)

Your tracking number is xxxxx (trackingnumber), will let you know when dispatch

Letter Id 3


Dear xxxx

Is this your correct address : xxxxxxxxxxxxxxxx (billing address and postcode). If not please can you send us your details


Basically what i'm trying to do in code is from the letter ID determine what letter and information to put in. So if it was letter Id i would like to add the name on to the field after Dear.

Is there a way in code which selects each letter and puts in the missing information.

I appreicate your help

Thank you

lagbolt
09-28-2007, 07:12 AM
Yes. Check out the Replace() function. It replaces a substring within a string with some other string and returns the modified string. And if you can figure that out, using the Replace() function will seem easy.