I have a text box were the control source is =Getusrlbl1([sam_id]). When the VBA runs I get a #Error on my report. The code is:
Private Function Getusrlbl1 (id As String)
On Error Resume Next
Dim rst As Recordset
Dim stSQL AS String
stSQL = "Select usrlbl1 form qurPCincompleteTest where sam_id=" &id
Set rst = currentdb.OpenRecordset(stSQL)
rst.MoveFirst
ect.....
Dose anyone have an idea why I'm getting and #Error on my report?? sam_id is on the report.
I found the answer today. Yes it is a string because the text is alphanumerica with a - in it. Long was the reason I was getting and #Error. Also at the end of the stSQL statement I did not have it right. It should be:
stSQK = "Select usrlbl1 form qurPCincompleteTest where sam_id='" &id&"'"
Thanks for the suggestions.
[This message has been edited by eason (edited 01-06-2000).]
Private Function Getusrlbl1 (id As String)
On Error Resume Next
Dim rst As Recordset
Dim stSQL AS String
stSQL = "Select usrlbl1 form qurPCincompleteTest where sam_id=" &id
Set rst = currentdb.OpenRecordset(stSQL)
rst.MoveFirst
ect.....
Dose anyone have an idea why I'm getting and #Error on my report?? sam_id is on the report.
I found the answer today. Yes it is a string because the text is alphanumerica with a - in it. Long was the reason I was getting and #Error. Also at the end of the stSQL statement I did not have it right. It should be:
stSQK = "Select usrlbl1 form qurPCincompleteTest where sam_id='" &id&"'"
Thanks for the suggestions.
[This message has been edited by eason (edited 01-06-2000).]