Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-12-2022, 02:57 AM
bil_san1 bil_san1 is offline Fill in part of form based on checkbox state Windows 10 Fill in part of form based on checkbox state Office 2016
Novice
Fill in part of form based on checkbox state
 
Join Date: Oct 2022
Posts: 12
bil_san1 is on a distinguished road
Default Fill in part of form based on checkbox state

Hi,

Is the same result possible with a checkbox instead of a formfield.



If yes, can you please guide me.

Thanks

Quote:
Originally Posted by macropod View Post
Hi stct,

See attached. The document uses a dropdown formfield for the predefined values, and formula fields for the variable output. If you unprotect the document and press Alt-F9, you'll be able to see the formula field contents. Note that you must exit the formfield (via the TAB key) after updating it for the conditional output to appear.

Moderator Note: Split from this thread.
Reply With Quote
  #2  
Old 10-12-2022, 04:46 AM
macropod's Avatar
macropod macropod is offline Fill in part of form based on checkbox state Windows 10 Fill in part of form based on checkbox state Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by bil_san1 View Post
Is the same result possible with a checkbox instead of a formfield.
What kind of checkbox? Checkboxes and formfields are not mutually exclusive - there are, after all checkbox formfields...

In any event, it's hard to see how you would propose to make that work if the user checks two or more checkboxes.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-12-2022, 04:49 AM
Charles Kenyon Charles Kenyon is offline Fill in part of form based on checkbox state Windows 11 Fill in part of form based on checkbox state Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,138
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I put your question into its own thread since it is really a different question even if related. Please let us know what kind of checkbox you are using. (Word has three kinds of active checkboxes.)
Reply With Quote
  #4  
Old 10-12-2022, 07:12 AM
bil_san1 bil_san1 is offline Fill in part of form based on checkbox state Windows 10 Fill in part of form based on checkbox state Office 2016
Novice
Fill in part of form based on checkbox state
 
Join Date: Oct 2022
Posts: 12
bil_san1 is on a distinguished road
Default

Hi Paul,

I have posted the question on your other post. But unfortunately it got moved or removed.

The document in the #1 post has help me a little.

But when I am creating a second Checkbox2 its not working.

Second is it possible to allow user to only select one checkbox only.

Can you please guide me and explain in details, how to get it worked.

Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
With ContentControl
  Select Case .Title
    Case "CheckBox1"
      If .Checked = True Then
        ActiveDocument.CustomDocumentProperties("Chk1").Value = 1
      Else
        ActiveDocument.CustomDocumentProperties("Chk1").Value = 0
      End If
    Case "CheckBox2"
      If .Checked = True Then
        ActiveDocument.CustomDocumentProperties("Chk2").Value = 1
      Else
        ActiveDocument.CustomDocumentProperties("Chk2").Value = 0
      End If
    Case Else
  End Select
End With
Application.ActiveWindow.View.ShowFieldCodes = False
Application.Options.PrintFieldCodes = False
ActiveDocument.Fields.Update
Application.ScreenUpdating = True
End Sub

Last edited by bil_san1; 10-12-2022 at 01:11 PM.
Reply With Quote
  #5  
Old 10-12-2022, 01:08 PM
bil_san1 bil_san1 is offline Fill in part of form based on checkbox state Windows 10 Fill in part of form based on checkbox state Office 2016
Novice
Fill in part of form based on checkbox state
 
Join Date: Oct 2022
Posts: 12
bil_san1 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
What kind of checkbox? Checkboxes and formfields are not mutually exclusive - there are, after all checkbox formfields...

In any event, it's hard to see how you would propose to make that work if the user checks two or more checkboxes.
Any type of checkbox which can complete the requirement without too much hassle.

I want multiple checkboxes so the user can select any 1 checkbox only and a text field populates according to the selection.

If you can provide the code with some explanation. So I can play with it for understanding. It would be a great help.
Reply With Quote
  #6  
Old 10-12-2022, 02:42 PM
Guessed's Avatar
Guessed Guessed is offline Fill in part of form based on checkbox state Windows 10 Fill in part of form based on checkbox state Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,975
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Can you provide an example document showing the checkbox and the text fields and what needs to be in those fields when the user checks the checkbox?

What do you want to happen if they subsequently uncheck the checkbox?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #7  
Old 10-13-2022, 07:53 AM
bil_san1 bil_san1 is offline Fill in part of form based on checkbox state Windows 10 Fill in part of form based on checkbox state Office 2016
Novice
Fill in part of form based on checkbox state
 
Join Date: Oct 2022
Posts: 12
bil_san1 is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Can you provide an example document showing the checkbox and the text fields and what needs to be in those fields when the user checks the checkbox?

What do you want to happen if they subsequently uncheck the checkbox?

There are 2 checkboxes. First checkbox is working fine but the second checkbox is not giving any output.

If they select the checkbox certain output text will appear and on unchecking that text will disappear.

Second question is it possible that they can only check one box at a time.

File is attached
Attached Files
File Type: docm Test CheckBox.docm (31.1 KB, 4 views)
Reply With Quote
  #8  
Old 10-13-2022, 02:14 PM
macropod's Avatar
macropod macropod is offline Fill in part of form based on checkbox state Windows 10 Fill in part of form based on checkbox state Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your code relies on there being two Custom Document Properties in the document - Chk1 and Chk2. Only Chk1 exists in your attachment.

It is far from clear as to why you would want two checkboxes, as clicking any checkbox one or more times will toggle its checked state on/off each time. Nevertheless, I've added the Chk2 Custom Document Property and revised the code so that only one checkbox can be checked.
Attached Files
File Type: docm Test CheckBox.docm (32.9 KB, 6 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 10-14-2022, 12:18 AM
bil_san1 bil_san1 is offline Fill in part of form based on checkbox state Windows 10 Fill in part of form based on checkbox state Office 2016
Novice
Fill in part of form based on checkbox state
 
Join Date: Oct 2022
Posts: 12
bil_san1 is on a distinguished road
Default

Thank you so much
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicating a set of form fields in a fill-able form ChuckT Word 1 02-10-2021 08:07 PM
Fill in part of form based on checkbox state Form auto fill based on a different field value. stct Word 26 06-15-2019 04:08 PM
Formula needed. If I write a specific name then I want the corresponding part number to fill kmurph Excel 1 11-28-2018 12:02 AM
Fill in part of form based on checkbox state Assigning Currency values to checkbox with sum presented as part of paragraph Edwords Word VBA 24 07-24-2018 03:50 AM
Fill in part of form based on checkbox state Date auto-populates based on checkbox mcarter9000 Word VBA 5 12-23-2010 12:39 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:50 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft