Change Value of Check Box Form Field in Word based on Field in Access

ChrisCione

Board Regular
Joined
Aug 27, 2008
Messages
92
Office Version
  1. 365
Platform
  1. Windows
Here's VBA (which was kindly provided to me) that I use to pass data from an Access record to autocomplete a fillable Word document. Is it possible to "check" a Check Box Form Field in the Word document, vs. just passing through the value of the field? If so, how can I incorporate that code into the sub below?

Code:
Private Sub cmdRepBBGo_Click()
'Download to Rep Broadband Word Templates.
  Dim appWord As Word.Application
  Dim doc As Word.Document
  'Avoid error 429, when Word isn’t open.
  On Error Resume Next
  Err.Clear
  'Set appWord object variable to running instance of Word.
  Set appWord = GetObject(, "Word.Application")
  If Err.Number <> 0 Then
    'If Word isn’t open, create a new instance of Word.
    Set appWord = New Word.Application
  End If
  Dim strDocFile As String
  Select Case Me.cboTemplateRepBB
  Case "ERS"
  strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (ERS Rep BroadBand).doc"
  Case "ERS - BC"
  strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (ERS Rep BroadBand) BC.doc"
  Case "Open"
  strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (OPEN Rep BroadBand).doc"
  Case "Open - BC"
  strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (OPEN Rep BroadBand) BC.doc"
  Case "Contractual"
  strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (Contractual Rep BroadBand).doc"
  Case "Contractual - BC"
  strDocFile = "L:\Bper Spec\Cione\Database Files\Announcement (Contractual Rep BroadBand) BC.doc"
  End Select
  Set doc = appWord.Documents.Open(strDocFile, , True)
  With doc
    .FormFields("Classification").Result = Me!Classification
    .FormFields("ClassCode").Result = Me!ClassCode
    .FormFields("JobAnnoID").Result = Me!JobAnnoID
    .FormFields("JobAnnoCode").Result = Me!JobAnnoCode
    .FormFields("Cert").Result = Me!CertNumber
    .FormFields("PositionNumber").Result = Me!PositionNumber
    .FormFields("DateClassApproved").Result = Me!DateClassApproved
    .FormFields("DateExemptionApprove").Result = Me!DateExemptionApproved
    .FormFields("Division").Result = Me!Division
    .FormFields("BureauFacility").Result = Me!BureauFacility
    .FormFields("WorkCity").Result = Me!WorkCity
    .FormFields("WorkCounty").Result = Me!WorkCounty
    .FormFields("CountyNumber").Result = Me!CountyNumber
    .FormFields("PaySchedule").Result = Me!PaySchedule
    .FormFields("PayRange").Result = Me!PayRange
    .FormFields("BargainingUnit").Result = Me!BargainingUnit
    .FormFields("MinStartingSalaryYr").Result = Me!MinimumStartingSalaryYr
    .FormFields("MaxPUASalaryYr").Result = Me!MaximumPUASalaryYr
    .FormFields("ProbationTerm").Result = Me!ProbationTerm
    .FormFields("ApplicationDeadline").Result = Me!ApplicationDeadline
    .FormFields("ERSPostingDate").Result = Me!ERSPostingDate
    .FormFields("ERSDeadlineDate").Result = Me!ERSDeadlineDate
    .FormFields("WISCJOBSPosting").Result = Me!WISCJOBSPosting
    .FormFields("WISCJOBSDeadline").Result = Me!WISCJOBSDeadline
    .FormFields("DateReferralsSent").Result = Me!DateReferralsSent
    .FormFields("Criteria1").Result = Me!Criteria1
    .FormFields("Criteria2").Result = Me!Criteria2
    .FormFields("Criteria3").Result = Me!Criteria3
    .FormFields("RegisterDate").Result = Me!RegisterDate
    .FormFields("WorkingTitle").Result = Me!WorkingTitle
    .FormFields("Duties").Result = Me!Duties
    .FormFields("KSA").Result = Me!KSA
    .FormFields("Specialist").Result = Me!Specialist
    .FormFields("Specialist1").Result = Me!Specialist
    .FormFields("Specialist2").Result = Me!Specialist
    .FormFields("Specialist3").Result = Me!Specialist
    .FormFields("SpecialistEmail").Result = Me!SpecialistEmail
    .FormFields("SpecialistEmail1").Result = Me!SpecialistEmail
    .FormFields("SpecialistEmail2").Result = Me!SpecialistEmail
    .FormFields("SpecialistEmail3").Result = Me!SpecialistEmail
    .FormFields("SpecialistPhone").Result = Me!SpecialistPhone
    .FormFields("SpecialistPhone1").Result = Me!SpecialistPhone
    .FormFields("SpecialistPhone2").Result = Me!SpecialistPhone
    .FormFields("SpecialistPhone3").Result = Me!SpecialistPhone
    .Visible = True
    .Activate
  End With
  Set doc = Nothing
  Set appWord = Nothing
  Exit Sub
  
errHandler:
  MsgBox Err.Number & ": " & Err.Description
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top