![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
My VBA Code in Access performs the following control: (1) Verifies that an employee does not have a computer already assigned to him. (2) The same computer is not assigned to another person. (in other words the computer is checked out under another employee, but the 'ReturnDate' Field is empty (null). Here is the Access VBA Code I used. Any help on getting this function to work in Filemaker would be appreciated. Private Sub Form_BeforeUpdate(Cancel As Integer) Dim strWhere As String Dim strMsg As String Dim varResult As Variant If IsNull(Me.ReturnDate) And Not (IsNull(Me.EmployeeID) Or IsNull(Me.ComputerID)) Then 'Block 2 assignments to same employee. strWhere = "(ReturnDate Is Null) AND (EmployeeID = " & _ Me.EmployeeID & ") AND (AssignID <> " & Me.AssignID & ")" varResult = DLookup("ComputerID", "Assign", strWhere) If Not IsNull(varResult) Then Cancel = True strMsg = strMsg & "Employee already has computer " & varResult & "." & vbCrLf End If 'Block assigning computer to 2 employees. strWhere = "(ReturnDate Is Null) AND (ComputerID = " & _ Me.ComputerID & ") AND (AssignID <> " & Me.AssignID & ")" varResult = DLookup("EmployeeID", "Assign", strWhere) If Not IsNull(varResult) Then Cancel = True strMsg = strMsg & "Computer already assigned to employee " & varResult & "." & vbCrLf End If End If 'Display message. If Cancel Then strMsg = strMsg & vbCrLf & "Correct the entry, or press <Esc to undo." MsgBox strMsg, vbExplanation, "Invalid entry" End If End Sub Again....since I am new to Filemaker....I would appreciate any help...as detailed as possible! Thanks |
![]() |
| Thread Tools | |
| Display Modes | |
| |