Avatar of LiMa
LiMa

asked on 

Send tick symbol from Access to a Word template

When sending text from a form to Access to Word is it possible to send a tick symbol? I want to send a tick to a custom property on my Word template but I do not know how to go about this. The code II am using to send the other text to Word is below.

Public Sub WordReport()
On Error GoTo ErrCreateWordVersion
Dim objWord As Object
Dim objProperties As Object
Dim strWordTemplate As String
Dim objDoc As Object
   strWordTemplate = Access.Application.CurrentProject.Path & "\Template.dot"
   Set objWord = CreateObject("Word.Application")
   objWord.Visible = True
   Set objDoc = objWord.Documents
   objDoc.Add strWordTemplate
   
   ' Other properties in here
   Set objProperties = objWord.ActiveDocument.CustomDocumentProperties
   With Me
      objProperties.Item("Process").Value = .txtProcess
      objProperties.Item("ReportNo").Value = .txtReportNo
      objProperties.Item("Area").Value = .txtArea
      objProperties.Item("Summary").Value = txtSummary
      objProperties.Item("Checked").Value = chkChecked ' THIS IS THE FIELD I WANT TO SEND A TICK AS DISPLAYED ON THE FORM
   End With
   With objWord.Selection
      .WholeStory
      .Fields.Update
      .Collapse Direction:=wdCollapseEnd
   End With

   Set objProperties = Nothing
   Set objDoc = Nothing
   
ErrCreateWordVersion:
   If Err.Number <> 0 And Err.Number <> 13 Then
      MsgBox Err.Number & " " & Err.Description
      On Error Resume Next
   End If
   Set objProperties = Nothing
   Set objDoc = Nothing
   Set objWord = Nothing
End Sub

I am using Office 2003 on a Windows XP based system. Thanx in advance for any help with this - all help is greatly appreciated, many thanx.

LiMa
Microsoft WordMicrosoft Access

Avatar of undefined
Last Comment
harfang
Avatar of harfang
harfang
Flag of Switzerland image

Hello LiMa,

I'm guessing that "Checked" is an existing yes/no custom property. In that case, it accepts the values True and False. From your naming convention, chkChecked is likely a checkbox, returning either True or False.

Doesn't your code work? Do you get an error message either when compiling or when running this?

(°v°)
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of LiMa
LiMa

ASKER

harfang>> My code works but it puts a -1 or 0, this can be easily modified to put yes/no accordingly but I want to place a tick.

LiMa
Avatar of LiMa
LiMa

ASKER

Jeff, you are an absolute star!!! That works a treat. Thanx a lot for that. I think people have many ways of describing symbols, I just meant something that looks like a tick when you are marking something correct. Thanks again.

LiMa
Great!

Glad I could help!

Jeff Coachman
Avatar of harfang
harfang
Flag of Switzerland image

Well, if you are really manipulating document properties, you should create it as a boolean value. In that case, it accepts only True/Yes/-1 and False/No/0. What you are doing now is writing a value into a string property. In that case, a "checked box symbol" looks nice, but will be much more difficult to use.

If you return to your template and recreate the document property, you will see you have a choice of data type (text, date, yes/no, ...). I don't know if a yes/no field is or will be represented as a checkbox in later versions.

So, if this is a document property, think twice before writing a symbol into it.

Cheers!
(°v°)
Avatar of LiMa
LiMa

ASKER

Thanks harfang, I totally agree, but the report required must use tick (checked symbol), it has specified by the powers that be... Thanks again for the info and help.

LiMa
Avatar of harfang
harfang
Flag of Switzerland image

Ah, well, in that case... Have fun with this project nonetheless! (^v°)
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo