View Full Version : #Error in text box


eason
01-05-2000, 08:32 PM
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).]

Travis
01-05-2000, 11:08 PM
This is just a guess, but:
Private Function Getusrlbl1 (id As String)

Is id suppose to be a String or is it a Long?

If it's suppose to be a long it will error out.