hollyquinn
Registered User.
- Local time
- Today, 04:17
- Joined
- Oct 7, 2008
- Messages
- 17
Hi. I am having an issue with an Access database. There is a certain form in the database that we are getting some error messages on. The first error message is:
Access failed to evaluate one or more expressions because 'Enabled' was referenced in an expression. Only functions and properties that are considered to be safe are allowed in expression when Access runs in sandbox mode.
Someone else here changed the macro security settings to low and that resolved the first error message. Now we are getting this error message:
The expression Before Update you entered in the event property setting produced the following error: The Save action was canceled.
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I'll post the module code below and maybe someone can help? My knowledge of VBA is very basic and I just can't find the error. I've been searching for over an hour. Here's the code:
Option Compare Database
Option Explicit
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.BidPeriod) And IsNull(Me.Crew) Then
MsgBox "Please enter data for BOTH the the Bid Period and Crew Group, or blank for both!" _
& Chr(10) & " " _
& Chr(10) & "ASOK requires a Bid Period and a Crew Group to update the Training Schedule Matrix.", vbCritical + vbOKOnly, "ASOK Session Save"
Me.BidPeriod = Null
Me.Crew = Null
Cancel = True
Exit Sub
End If
If IsNull(Me.BidPeriod) And Not IsNull(Me.Crew) Then
MsgBox "Please enter data for BOTH the the Bid Period and Crew Group, or blank for both!" _
& Chr(10) & " " _
& Chr(10) & "ASOK requires a Bid Period and a Crew Group to update the Training Schedule Matrix.", vbCritical + vbOKOnly, "ASOK Session Save"
Me.BidPeriod = Null
Me.Crew = Null
Cancel = True
Exit Sub
End If
DoCmd.Save
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Not IsNull(Me.BidPeriod) And IsNull(Me.Crew) Then
MsgBox "Please enter data for BOTH the the Bid Period and Crew Group, or blank for both!" _
& Chr(10) & " " _
& Chr(10) & "ASOK requires a Bid Period and a Crew Group to update the Training Schedule Matrix.", vbCritical + vbOKOnly, "ASOK Session Save"
Me.BidPeriod = Null
Me.Crew = Null
Cancel = True
Exit Sub
End If
If IsNull(Me.BidPeriod) And Not IsNull(Me.Crew) Then
MsgBox "Please enter data for BOTH the the Bid Period and Crew Group, or blank for both!" _
& Chr(10) & " " _
& Chr(10) & "ASOK requires a Bid Period and a Crew Group to update the Training Schedule Matrix.", vbCritical + vbOKOnly, "ASOK Session Save"
Me.BidPeriod = Null
Me.Crew = Null
Cancel = True
Exit Sub
End If
DoCmd.Save
End Sub
Any help would be so awesome. Thanks in advance.
Access failed to evaluate one or more expressions because 'Enabled' was referenced in an expression. Only functions and properties that are considered to be safe are allowed in expression when Access runs in sandbox mode.
Someone else here changed the macro security settings to low and that resolved the first error message. Now we are getting this error message:
The expression Before Update you entered in the event property setting produced the following error: The Save action was canceled.
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I'll post the module code below and maybe someone can help? My knowledge of VBA is very basic and I just can't find the error. I've been searching for over an hour. Here's the code:
Option Compare Database
Option Explicit
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.BidPeriod) And IsNull(Me.Crew) Then
MsgBox "Please enter data for BOTH the the Bid Period and Crew Group, or blank for both!" _
& Chr(10) & " " _
& Chr(10) & "ASOK requires a Bid Period and a Crew Group to update the Training Schedule Matrix.", vbCritical + vbOKOnly, "ASOK Session Save"
Me.BidPeriod = Null
Me.Crew = Null
Cancel = True
Exit Sub
End If
If IsNull(Me.BidPeriod) And Not IsNull(Me.Crew) Then
MsgBox "Please enter data for BOTH the the Bid Period and Crew Group, or blank for both!" _
& Chr(10) & " " _
& Chr(10) & "ASOK requires a Bid Period and a Crew Group to update the Training Schedule Matrix.", vbCritical + vbOKOnly, "ASOK Session Save"
Me.BidPeriod = Null
Me.Crew = Null
Cancel = True
Exit Sub
End If
DoCmd.Save
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Not IsNull(Me.BidPeriod) And IsNull(Me.Crew) Then
MsgBox "Please enter data for BOTH the the Bid Period and Crew Group, or blank for both!" _
& Chr(10) & " " _
& Chr(10) & "ASOK requires a Bid Period and a Crew Group to update the Training Schedule Matrix.", vbCritical + vbOKOnly, "ASOK Session Save"
Me.BidPeriod = Null
Me.Crew = Null
Cancel = True
Exit Sub
End If
If IsNull(Me.BidPeriod) And Not IsNull(Me.Crew) Then
MsgBox "Please enter data for BOTH the the Bid Period and Crew Group, or blank for both!" _
& Chr(10) & " " _
& Chr(10) & "ASOK requires a Bid Period and a Crew Group to update the Training Schedule Matrix.", vbCritical + vbOKOnly, "ASOK Session Save"
Me.BidPeriod = Null
Me.Crew = Null
Cancel = True
Exit Sub
End If
DoCmd.Save
End Sub
Any help would be so awesome. Thanks in advance.