Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / January 2006

Tip: Looking for answers? Try searching our database.

Password Protect a checkbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JNariss@gmail.com - 24 Jan 2006 20:21 GMT
Hello,

I have a form that we use for employee status changes (such as new hire
and terminate). I am creating a section within the form to allow users
to select various security requests (such as which apps. will be
installed and what they need security to). I included an area on my
form where you can check the box to request security. Checking this box
opens up my additional sections of security.

I was wondering if there is a way I can put a password onto that
checkbox so if a user checks it requesting the security sections they
must enter a password before they can just go in and select whatever
they want.  

Does anyone know if there is there a way to do this?
Greg Collins [InfoPath MVP] - 24 Jan 2006 22:36 GMT
You can try using code in an OnBeforeChange or OnAfterChange event handler.

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

Hello,

I have a form that we use for employee status changes (such as new hire
and terminate). I am creating a section within the form to allow users
to select various security requests (such as which apps. will be
installed and what they need security to). I included an area on my
form where you can check the box to request security. Checking this box
opens up my additional sections of security.

I was wondering if there is a way I can put a password onto that
checkbox so if a user checks it requesting the security sections they
must enter a password before they can just go in and select whatever
they want.  

Does anyone know if there is there a way to do this?
JNariss@gmail.com - 25 Jan 2006 17:47 GMT
I will try that and see what happens thanks.
JNariss@gmail.com - 25 Jan 2006 17:58 GMT
I have found how to edit/add code to the OnBeforeChange in the Event
Handler except I am unsure of how to start the code. In my other
database in Access I use the following code:

Private Sub cmdOK_Click()

On Error GoTo ErrorHandler

If IsNull(Me.txtPassword) Then
   MsgBox "Please enter a password " _
   & "before continuing.", _
   vbExclamation, "Missing Password"
   GoTo ExitPoint
End If

Dim EnteredPassword As String

EnteredPassword = Me.txtPassword

Select Case EnteredPassword
   Case "Red"
       ' Code here to open that
       ' person's report and/or form
       DoCmd.OpenForm "Submit To Production"
       DoCmd.Close acForm, "frmPassword"
   'Case "Orange"
       ' Code here to open that
       ' person's report and/or form
   'Case "Yellow"
       ' Code here to open that
       ' person's report and/or form
   'Case "Green"
       ' Code here to open that
       ' person's report and/or form
   'Case "Blue"
       ' Code here to open that
       ' person's report and/or form
   'Case "That funky bright yellow " _
       & "on the new Oregon Duck's uniform"
       ' Code here to open that
       ' person's report and/or form
   Case Else
       MsgBox "The password you have " _
       & "entered is invalid. Please " _
       & "re-enter.", vbExclamation, _
       "Invalid password"
   End Select

ExitPoint:
   Exit Sub

ErrorHandler:
   MsgBox Err.Description, vbCritical, _
   "Error #" & Err.Number
   Resume ExitPoint
End Sub

I was just wondering how to start the Private Sub............. what
would I enter after that? Private Sub OnBeforeChange_CheckBox()??

Thanks,
Justine
JNariss@gmail.com - 25 Jan 2006 20:52 GMT
Okay so here is what I tried and it told me the first line was an error
and it expected ";"

function msoxd__MacForm_SecurityOptions_attr::OnBeforeChange(eventObj)
{
    // Write your code here
    // Warning: ensure that the constraint you are enforcing is compatible
with the default value you set for this XML node.
    Private Sub SecurityOptions_OnBeforeChange()
    On Error GoTo ErrorHandler

    If IsNull(Me.txtPassword) Then
        MsgBox "Please enter a password" _
        & "before continuing.",_
        vbExclamation, "Missing Password"
        GoTo ExitPoint
    End If

    Dim EnteredPassword As String

    EnteredPassword = Me.txtPassword

    Select Case EnteredPassword
        Case "password"
        Case Else
            MsgBox "The password you have" _
            & "enters is invalid. Please" _
            & "contact the Help Desk.", vbExclamation, _
            "Invalid Password"
        End Select

    Exit Point:
        Exit Sub

    ErrorHandler:
        MsgBox err.Description, vbCritical, _
        "Error #" & err.Number
        Resume ExitPoint
   
    End Sub
}

If anyone could help here I would really appreciate it.
S.Y.M. Wong-A-Ton - 26 Jan 2006 07:46 GMT
The scripting language in InfoPath is probably set to JScript instead of
VBScript (see the "Default programming language" field on the "Design" tab
accessed through the Tools > Options menu), which is why you are getting the
error. In addition, you cannot just copy and paste an entire VBA Sub into an
InfoPath function. You'll need to look at how you can convert your Sub into
an InfoPath function or event handler more closely.

---
S.Y.M. Wong-A-Ton

> Okay so here is what I tried and it told me the first line was an error
> and it expected ";"
[quoted text clipped - 39 lines]
>
> If anyone could help here I would really appreciate it.
JNariss@gmail.com - 26 Jan 2006 14:41 GMT
Thanks for the reply. I changed the Default Programming Language to
VBScript. Do you know anything about how I would go about converting my
script or possibly point me into the right direction?

-Justine
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.