Hi there,
Below is code I have in an On Current Event item. I want it to run 2 SQL statements - one to see if they have an expired license and one to see if they have expired insurance. I can run it fine with just one of the statements, but it doesn't like when I have 2 statements. Am I missing a line in between or should I be utilizing something else? I'm already using the On Open slot for maximizing the form and the On Activate....
any ideas?
---------------------
Private Sub Form_Current()
If Me!MailAddressSameAsPhys = No Then
Me!OpenSubformMailAddress.Visible = True
Else
Me!OpenSubformMailAddress.Visible = False
End If
If Me!CanDoRemodelWork = Yes Then
Me!OpenVendorRemodelDetails.Visible = False
Else
Me!OpenVendorRemodelDetails.Visible = True
End If
Dim rec As ADODB.Recordset
Dim SQLstring As String
SQLstring = "SELECT TBLVendorLicensesByState.StateAbbr,TBLVendorLicensesByState.VendorID FROM TBLVendorLicensesByState WHERE(((TBLVendorLicensesByState.VendorID)=" & Me![VendorID] & "
AND(LicenseExpDt < #" & Now & "#));"
Set rec = CurrentProject.Connection.Execute(SQLstring)
If Not (rec.EOF) Then
MsgBox ("General Contractor has expired license(s). Please update."
End If
rec.Close
Set rec = Nothing
Dim rec As ADODB.Recordset
Dim SQLstring As String
SQLstring = "SELECT TBLVendorInfo.VendorID FROM TBLVendorInfo WHERE(((TBLVendorInfo.VendorID)=" & Me![VendorID] & "
AND(InsuranceExpDt < #" & Now & "#));"
Set rec = CurrentProject.Connection.Execute(SQLstring)
If Not (rec.EOF) Then
MsgBox ("General Contractor has expired insurance certificate. Please update."
End If
rec.Close
Set rec = Nothing
End Sub
Below is code I have in an On Current Event item. I want it to run 2 SQL statements - one to see if they have an expired license and one to see if they have expired insurance. I can run it fine with just one of the statements, but it doesn't like when I have 2 statements. Am I missing a line in between or should I be utilizing something else? I'm already using the On Open slot for maximizing the form and the On Activate....
any ideas?
---------------------
Private Sub Form_Current()
If Me!MailAddressSameAsPhys = No Then
Me!OpenSubformMailAddress.Visible = True
Else
Me!OpenSubformMailAddress.Visible = False
End If
If Me!CanDoRemodelWork = Yes Then
Me!OpenVendorRemodelDetails.Visible = False
Else
Me!OpenVendorRemodelDetails.Visible = True
End If
Dim rec As ADODB.Recordset
Dim SQLstring As String
SQLstring = "SELECT TBLVendorLicensesByState.StateAbbr,TBLVendorLicensesByState.VendorID FROM TBLVendorLicensesByState WHERE(((TBLVendorLicensesByState.VendorID)=" & Me![VendorID] & "
Set rec = CurrentProject.Connection.Execute(SQLstring)
If Not (rec.EOF) Then
MsgBox ("General Contractor has expired license(s). Please update."
End If
rec.Close
Set rec = Nothing
Dim rec As ADODB.Recordset
Dim SQLstring As String
SQLstring = "SELECT TBLVendorInfo.VendorID FROM TBLVendorInfo WHERE(((TBLVendorInfo.VendorID)=" & Me![VendorID] & "
Set rec = CurrentProject.Connection.Execute(SQLstring)
If Not (rec.EOF) Then
MsgBox ("General Contractor has expired insurance certificate. Please update."
End If
rec.Close
Set rec = Nothing
End Sub