hi when i run my login userform and click ok a macro message shud pop up stating the expired accounts on my database it worked fine before but when i tried to run it ERROR TYPE 13 pops up and its higlighting the
part of my code
LDiff was declared as Long
did i miss anything? hope u guys can help me thank you in advance
here the whole code
Code
Private Sub Workbook_Open()
usfrmlogin.show
Dim LRow As Long
Dim LResponse As String
Dim lname As String
Dim LFname As String
Dim LDiff As Long
Dim LDays As Long
LRow = 2
LDays = 90
With Sheets("DataBase")
While LRow < 200
If IsDate(.Range("Q" & LRow)) Then
LDiff = .Range("Q" & LRow).Value2 - Date
If (LDiff > 0) And (LDiff <= LDays) Then
lname = .Range("B" & LRow).Value
LFname = .Range("C" & LRow).Value
LResponse = LResponse & lname & "," & LFname & "License will expire in " & LDiff & "days." & Chr(10)
End If
End If
LRow = LRow + 1
Wend
If CBool(Len(LResponse)) Then
MsgBox "These Licenses are nearing expiration:" & Chr(10) & LResponse, vbCritical, "WARNING"
End If
End With
End Sub
Display More