Hello guys,
Im kind of stuck with an operation I'm trying to make happen in the On Current event of a form I have:
So far what I have, that is functioning exactly the way i need, is the following
[
Private Sub Form_Current()
On Error Resume Next
Me![ImageFrame].picture = Me![picture]
If LockBoundControls([Form], False) Then
LockBoundControls([Form], True) = True
Else
LockBoundControls([Form], True) = True
End If
End Sub
]
I need this because this form locks so there are no accidental typos when searching and to load a picture assigned to a record but I would also like to add to this that when the form loads it checks the status of the record and if it meets a certain criteria it will open another form to a record of the matching unique ID, the following is what I came up with and tried to add at the end of the above statement as follows:
[
End If
If Me.Status = "On Vacation" Or "On Leave" Then
DoCmd.OpenForm "Employee Time Off Request", , , "EmployeeID = " & Me.EmployeeID
End If
End Sub
]
After several attempts and several different configurations of the two pieces I have not been successful.
Each time it will load the current record of the Me. form but it will also pop up the other form, no matter what i do. What I need is for the other form to load only if the criteria is met.
I have a sneaking suspicion that it may be due to the fact that the form locks on current but I dont know and have exhausted my other research avenues in attempts to find a solution.
I appreciate you taking the time to read this and any help you can give me.
thanks,
Im kind of stuck with an operation I'm trying to make happen in the On Current event of a form I have:
So far what I have, that is functioning exactly the way i need, is the following
[
Private Sub Form_Current()
On Error Resume Next
Me![ImageFrame].picture = Me![picture]
If LockBoundControls([Form], False) Then
LockBoundControls([Form], True) = True
Else
LockBoundControls([Form], True) = True
End If
End Sub
]
I need this because this form locks so there are no accidental typos when searching and to load a picture assigned to a record but I would also like to add to this that when the form loads it checks the status of the record and if it meets a certain criteria it will open another form to a record of the matching unique ID, the following is what I came up with and tried to add at the end of the above statement as follows:
[
End If
If Me.Status = "On Vacation" Or "On Leave" Then
DoCmd.OpenForm "Employee Time Off Request", , , "EmployeeID = " & Me.EmployeeID
End If
End Sub
]
After several attempts and several different configurations of the two pieces I have not been successful.
Each time it will load the current record of the Me. form but it will also pop up the other form, no matter what i do. What I need is for the other form to load only if the criteria is met.
I have a sneaking suspicion that it may be due to the fact that the form locks on current but I dont know and have exhausted my other research avenues in attempts to find a solution.
I appreciate you taking the time to read this and any help you can give me.
thanks,