This is my code:
Private Function Getpan_wt(id As String)
On Error Resume Next
Dim rst As Recordset
Dim stSQL As String
stSQL = "Select display_text From qryPC_BulkMois Where id='" & id & "' And res_name='" & pan_wt & "' And rep_num='" & Me.rep_num & "'"
Set rst = Current Db.OpenRecordset(stSQL)
Getpan_wt = Getpan_wt & rst.Fields("display_text")
End Function
When I take the last And statement out the code work but I get a duplicate for every rep_num on the report, but if I leave it in the report is blank. Rep_num is the number of times this item was tested such as test 1 2 3 up to 10. The display-text is the result of the test. The test name is pan_wt and the id is what is being tested. I also need to have an underline appear if display_text is empty, meaning the test results have not been entered yet.
Private Function Getpan_wt(id As String)
On Error Resume Next
Dim rst As Recordset
Dim stSQL As String
stSQL = "Select display_text From qryPC_BulkMois Where id='" & id & "' And res_name='" & pan_wt & "' And rep_num='" & Me.rep_num & "'"
Set rst = Current Db.OpenRecordset(stSQL)
Getpan_wt = Getpan_wt & rst.Fields("display_text")
End Function
When I take the last And statement out the code work but I get a duplicate for every rep_num on the report, but if I leave it in the report is blank. Rep_num is the number of times this item was tested such as test 1 2 3 up to 10. The display-text is the result of the test. The test name is pan_wt and the id is what is being tested. I also need to have an underline appear if display_text is empty, meaning the test results have not been entered yet.