I need to have a module search through a table of each field on each record and get the field names if value is -1(which is checked) and return the field name(s)
im having trouble opening the recordset and searching
this is what i have so far
Public Function GetExceptions()
Set db = CurrentDb
Set rs = db.OpenRecordset("tblRTisPrintExcept", dbOpenTable)
rs.MoveFirst
Do Until rs.EOF
If rs.Fields(0).Value = [Forms]![frm_ReportsRetailDaily].lblDate.Caption Then
If rs.Fields(2).Value = -1 Then
exception = rs.Fields(2).Value
MsgBox rs.Fields(2).Value
GetExceptions = rs.Fields(2).Value
End If
End If
rs.MoveNext
Loop
rs.Close
db.Close
End Function
for some reason it doesnt seem like it is doing anything when the function is called, is there something wrong when im trying to return the variable
so i need this function to be executed in a report control and run multiple times.
im having trouble opening the recordset and searching
this is what i have so far
Public Function GetExceptions()
Set db = CurrentDb
Set rs = db.OpenRecordset("tblRTisPrintExcept", dbOpenTable)
rs.MoveFirst
Do Until rs.EOF
If rs.Fields(0).Value = [Forms]![frm_ReportsRetailDaily].lblDate.Caption Then
If rs.Fields(2).Value = -1 Then
exception = rs.Fields(2).Value
MsgBox rs.Fields(2).Value
GetExceptions = rs.Fields(2).Value
End If
End If
rs.MoveNext
Loop
rs.Close
db.Close
End Function
for some reason it doesnt seem like it is doing anything when the function is called, is there something wrong when im trying to return the variable
so i need this function to be executed in a report control and run multiple times.