W
Week Day Calculation
I have a form that uses an event procedure to lookup the name when a loan
number is entered. I need a message to display when the loan number is left
blank that says "You must enter a Loan #", but instead I get a runtime error
94 "Invalid use of null". This is the code I am using for the event
procedure. What do I need to change?
Option Compare Database
Private Sub FindLoan_Click()
On Error GoTo Err_FindLoan_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_FindLoan_Click:
Exit Sub
Err_FindLoan_Click:
MsgBox Err.Description
Resume Exit_FindLoan_Click
End Sub
Private Sub ExitFrm_Click()
On Error GoTo Err_ExitFrm_Click
DoCmd.Close
Exit_ExitFrm_Click:
Exit Sub
Err_ExitFrm_Click:
MsgBox Err.Description
Resume Exit_ExitFrm_Click
End Sub
Private Sub Loan__BeforeUpdate(Cancel As Integer)
Dim varLoanNum As String
Dim strMsg As String
If IsNull(varLoanNum) Then
strMsg = "You Must Enter Loan Number"
End If
End Sub
Private Sub Loan__Exit(Cancel As Integer)
Dim varBorrower As String
Dim varLoanNum As String
Dim strMsg As String
varBorrower = DLookup("[Borrower]", "LoanNum Tbl", "[Loan Num] = [Loan#]")
If (Not IsNull(varBorrower)) Then Me![Borrower] = varBorrower
End Sub
Private Sub NewRcrd_Click()
On Error GoTo Err_NewRcrd_Click
DoCmd.GoToRecord , , acNewRec
Exit_NewRcrd_Click:
Exit Sub
Err_NewRcrd_Click:
MsgBox Err.Description
Resume Exit_NewRcrd_Click
End Sub
Private Sub Command53_Click()
On Error GoTo Err_Command53_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command53_Click:
Exit Sub
Err_Command53_Click:
MsgBox Err.Description
Resume Exit_Command53_Click
End Sub
number is entered. I need a message to display when the loan number is left
blank that says "You must enter a Loan #", but instead I get a runtime error
94 "Invalid use of null". This is the code I am using for the event
procedure. What do I need to change?
Option Compare Database
Private Sub FindLoan_Click()
On Error GoTo Err_FindLoan_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_FindLoan_Click:
Exit Sub
Err_FindLoan_Click:
MsgBox Err.Description
Resume Exit_FindLoan_Click
End Sub
Private Sub ExitFrm_Click()
On Error GoTo Err_ExitFrm_Click
DoCmd.Close
Exit_ExitFrm_Click:
Exit Sub
Err_ExitFrm_Click:
MsgBox Err.Description
Resume Exit_ExitFrm_Click
End Sub
Private Sub Loan__BeforeUpdate(Cancel As Integer)
Dim varLoanNum As String
Dim strMsg As String
If IsNull(varLoanNum) Then
strMsg = "You Must Enter Loan Number"
End If
End Sub
Private Sub Loan__Exit(Cancel As Integer)
Dim varBorrower As String
Dim varLoanNum As String
Dim strMsg As String
varBorrower = DLookup("[Borrower]", "LoanNum Tbl", "[Loan Num] = [Loan#]")
If (Not IsNull(varBorrower)) Then Me![Borrower] = varBorrower
End Sub
Private Sub NewRcrd_Click()
On Error GoTo Err_NewRcrd_Click
DoCmd.GoToRecord , , acNewRec
Exit_NewRcrd_Click:
Exit Sub
Err_NewRcrd_Click:
MsgBox Err.Description
Resume Exit_NewRcrd_Click
End Sub
Private Sub Command53_Click()
On Error GoTo Err_Command53_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command53_Click:
Exit Sub
Err_Command53_Click:
MsgBox Err.Description
Resume Exit_Command53_Click
End Sub