techguy2010
Technical User
Hello,
I'm not sure if this is the correct area to be posting this in, but I thought I would see what help I can get. I've inherited a database (built by someone no longer with the company) that is used for recruiting purposes, but there is a portion of it that appears to not be functioning properly.
In the database there is a button to e-mail roster information, but upon clicking it, it gives an error of "Invalid Use of Null" (something similar to that - I don't have the exact error at this time which I know would be helpful).
When doing a debug of that error, it highlights the following portion of code:
Looking at the code, I was able to see the following sections that appear to work in conjunction with each other
The hightlighted area mentioned points to a module where the following was found:
As mentioned, I inherited this from someone else and I'm just trying to fix this portion of the database as it could prove helpful. I'm just trying to get a general idea as to what is holding up getting the e-mail roster button to work (and hopefully get it fixed). Let me know if there is any additional information.
Thanks in advance!
I'm not sure if this is the correct area to be posting this in, but I thought I would see what help I can get. I've inherited a database (built by someone no longer with the company) that is used for recruiting purposes, but there is a portion of it that appears to not be functioning properly.
In the database there is a button to e-mail roster information, but upon clicking it, it gives an error of "Invalid Use of Null" (something similar to that - I don't have the exact error at this time which I know would be helpful).
When doing a debug of that error, it highlights the following portion of code:
Code:
strBody = DA.CreateRosterEmail(classID)
Looking at the code, I was able to see the following sections that appear to work in conjunction with each other
Code:
Private Sub EmailRosterDetails_Click()
Dim DA As DataAccess
Dim oLook As Object
Dim oMail As Object
Dim olns As Outlook.NameSpace
Dim strBody As String
Dim emailSubject As String
Set DA = New DataAccess
strBody = DA.CreateRosterEmail(classID)
If Not strBody = "" Then
Set oLook = CreateObject("Outlook.Application")
Set olns = oLook.GetNamespace("MAPI")
Set oMail = oLook.CreateItem(0)
emailSubject = "Class Roster - " & DA.getClassDateByClassID(classID)
With oMail
.To = agentEmailAddress
.Subject = emailSubject
.HTMLBody = strBody
.Display
End With
MsgBox "Recruiting email report is being generated. Please check your outlook."
Else
MsgBox "There are no open classes to report on."
End If
End Sub
The hightlighted area mentioned points to a module where the following was found:
Code:
Public Function CreateRosterEmail(classID As Double) As String
Dim reportString As String
Dim rosterRec As Recordset
Dim lunchString As String
Me.CreateRosterRecordSet classID, rosterRec
If Not (rosterRec.EOF And rosterRec.BOF) Then
reportString = "<HTML><head><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"
reportString = reportString & "<style><!--table{font-family: 'Calibri', serif;font-size: 14px;table-layout: fixed;border: 1px solid #003057;}"
reportString = reportString & "td {border: 1px solid #003057;border-collapse: collapse;padding: 5px;}"
reportString = reportString & "td.bottom {height: 100px;text-align: left;vertical-align: top;padding: 5px;}--></style>"
reportString = reportString & "<table><tr><td style='font-weight: bold; background-color: #b3d9ff; width: 140px;'>LastName</td>"
reportString = reportString & "<td style='font-weight: bold; background-color: #b3d9ff; width: 140px;'>FirstName</td>"
reportString = reportString & "<td style='font-weight: bold; background-color: #b3d9ff; width: 80px;'>ID1</td>"
reportString = reportString & "<td style='font-weight: bold; background-color: #b3d9ff; width: 80px;'>ID2</td>"
reportString = reportString & "<td style='font-weight: bold; background-color: #b3d9ff; width: 80px;'>ID3</td>"
reportString = reportString & "<td style='font-weight: bold; background-color: #b3d9ff; width: 140px;'>WorkEmail</td>"
reportString = reportString & "<td style='font-weight: bold; background-color: #b3d9ff; width: 250px;'>Schedule</td>"
reportString = reportString & "<td style='font-weight: bold; background-color: #b3d9ff; width: 200px;'>Lunch/Dessert</td></tr>"
rosterRec.MoveFirst
Do While Not rosterRec.EOF
If Not rosterRec!meal = "" Then
lunchString = rosterRec!meal & ", " & rosterRec!dessert
Else
lunchString = ""
End If
reportString = reportString & "<tr><td>" & rosterRec!lastName & "</td><td>" & rosterRec!firstName & "</td><td>" & rosterRec!id1 & "</td><td>"
reportString = reportString & rosterRec!id2 & "</td><td>" & rosterRec!id3 & "</td><td>" & rosterRec!workEmail & "</td><td>"
reportString = reportString & Me.GetScheduleByScheduleID(rosterRec!scheduleID) & "</td><td>" & lunchString & "</td></tr>"
rosterRec.MoveNext
Loop
reportString = reportString & "</table>"
Else
reportString = ""
End If
CreateRosterEmail = reportString
End Function
As mentioned, I inherited this from someone else and I'm just trying to fix this portion of the database as it could prove helpful. I'm just trying to get a general idea as to what is holding up getting the e-mail roster button to work (and hopefully get it fixed). Let me know if there is any additional information.
Thanks in advance!