I will try that and see what happens thanks.
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