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

Access to Word losing format

Status
Not open for further replies.

DomFino

IS-IT--Management
Jul 9, 2003
278
US
Hi all,
I am using word to create several forms that use bookmarks. I then use VBA in Access to export the data to the appropriate form in word.

My problem is the SSN and Telephone fields lose formating in the word bookmark field. The date fields do not.

I have the bookmark fields as TEXT, since that is what they are in Access. I tried changing the bookmark to NUMBER and formated the SSN field as ##-###-####, but that did not work either.

Any suggestions?

Thanks
Dom

Sample Access Code:
Code:
ActiveDocument.Bookmarks("EmplSSN").Select
        .Selection.Text = (CStr(Me!EmplSSN))
        .ActiveDocument.Bookmarks("EmplDOB").Select
        .Selection.Text = (CStr(Me!EmplDOB))[\code]
 
Have you tried the Format function instead of CStr ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,
Thanks for pointing me in the correct direction. I read up on the Format function and after a few miss starts, I finally got it to work.

Code:
.Selection.Text = (Format(Me!EmplHomePhone, "(@@@) @@@-@@@@"))

Thanks again for your help,
Dom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top