stSQL has to many parameters (1 Viewer)

eason

Registered User.
Local time
Today, 06:45
Joined
Nov 3, 1999
Messages
31
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.
 

Travis

Registered User.
Local time
Today, 04:45
Joined
Dec 17, 1999
Messages
1,332
Try this:

only have the ' ' on data that is a string. I think you have them around a numeric value, thus making it think its a string.
 

Users who are viewing this thread

Top Bottom