PDA

View Full Version : Left String, Mid String and Right String & Word



PAW504
11-23-2007, 07:28 AM
Hi Forum,

Is it possible to apply Left String, Mid String and Right String to a field that is being passed through Word Merge - I have assumed from reading on the net - that it's possible through VBA.

The use is for a field - FORENAMES which can contain First Name and subsequent Middle Names. I am looking at Left Trimming the field at the SPACE character - so Billy Jean would return just Billy.

Also expanding on this - I have a field which is the resultant of concatinations of other fields. The field always contains the same number of Pipes (|) between the old fields but they are not fixed positions. I have been asked to "extract" the second data set from this field - so "1601740|Dining Room Asst XCH|H2R|Dining Room|" would result in "Dining Room Asst XCH" - unfortunatly I have no Access to the old data, as this is being passed to our database already concatinated - so I can't cheat.

Anyone got any ideas - for a complete novice at VBA?

Many thanks

Paul Woodward:banghead: :banghead:

TonyJollans
11-24-2007, 01:31 AM
Whilst doing this kind of thing is possible in Word, it really isn't sensible. Make a Query in your database to create the data as you want it and use that Query as the base for your Mail Merge.