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

Checkboxes and strigs

Status
Not open for further replies.

RCorrigan

MIS
Feb 24, 2004
2,872
MT
I have a form that passes data via bookmarks to a word doc

I have a frame with 4 checkboxes in :

All , opt1, opt2, opt3

I have the following code

Code:
 If chkall = True Then (strall = "Access Required to All " & stropt1 = "Please see above" & stropt2 = "Please see above" & stropt3 = "Please see above")

Is this possible ??

<Do I need A Signature or will an X do?>
 
Hi there!
I could use some clarification. [smile]

What does this mean? What exactly are you passing to Word?
I have a form that passes data via bookmarks to a word doc

Does your code generate an error? Looking at what the code you posted, I assume you are getting the state of a check box you have named chkall. But it looks like you have assigned string variables to the various options you have.

Here's what I need to know:

What you would like to pass to Word
What error (if any) you are presently experiencing
What the rest of your code is

Tom



Born once die twice; born twice die once.
 
On the form there are checkboxes :

Select which acces is required :

[box]Option 1
[box]Option 2
.....
[box] Option 10

if option 1 is checked then it creates a string -"access req for option 1) that is put into the doc at a bookmark

(It's to force users to print request forms not scribble then in crayon and throw them at me !!!)

so I have

Code:
dim strOPT1 as string
dim strOPT2 as string
.......

if chkOPT1 = true then strOPT1 = "Access required for Opt1)
if chkOPT1 = false then strOPT1 = "No access req"
.......

if chkOPT1 = false  and chkOPT2 = false then
     msgbox "Please make at least one choice"
     exit sub
end if

Application.ScreenUpdating = False
        
        With ActiveDocument

        .Bookmarks("Option1").Range.Text = strOPT1
        .Bookmarks("Option2").Range.Text = strOPT2

        End With
        
        Application.ScreenUpdating = True
        
        ActiveDocument.PrintPreview
                        
        ActiveDocument.PrintOut copies = 1

Now if i put an option in for all, if that is checked then the strALL = "Access required for ALL Options" and all the other relevant strings say "Please see above"

Hope this clarifies things
(and apologies for the appauling code I'm new !!!!!)

<Do I need A Signature or will an X do?>
 
One more question:

What do you want your code to do that it doesn't already do?

Tom

Born once die twice; born twice die once.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top