Help with automating a letter from access using vba

danboi10

Registered User.
Local time
Yesterday, 23:20
Joined
Aug 15, 2012
Messages
19
Hi All,

Hoping somebody maybe able to help with a little query regarding access vba. I have used VBA to develop an automated letter that is run from access. It works....which is a miracle! However one field is driving me insane:banghead: and it revolves around the combo box. In the Access form view I have set the bound column and column count to show the field name in this case it is organisation but when i come to the the vba is goes back to showing the id number

Code:
WrdApp.Selection.TypeText Text:=StrConv([ORGANISATION], vbProperCase)

Now the above works for all the other fields which are simple text fields ie if i put surname in the correct surname appears in the word document.

Any advice to help me along the way would be brilliant.

Thanks,
Dan.
 
Try

WrdApp.Selection.TypeText Text:=StrConv(Me.[ORGANISATION].Column(x), vbProperCase)

Using the appropriate column number, and presuming your combo name is ORGANISATION.
 
If [ORGANISATION] is your combo box name, its value after selection depends on the .BoundColumn property. However, you should note that this column is zero-based.

If you used the wizard to create the box, it asked you for the name of the field, not the column number, so it does the right thing automatically. If you created the box "the hard way" then check the bound column number.
 
Happy to help.
 

Users who are viewing this thread

Back
Top Bottom