Hi, I'm trying to code a function that writes directly the status on a query field when called.
The code I wrote is just for test as for now and looks like this:
I just want a column that shows "bing" for everyrow, because I am trying to check my code, but the thing is if I set the rs it comes empty. If I delete the Setting for the rs, then It shows "bing".
The idea was that the function should check the content from the different fields in the query recordset and return a value based on that, but if I can't even get it to show thins that should always be displayed I am doing something wrong.
Any idea? I can't understand why it came empty.
The code I wrote is just for test as for now and looks like this:
Public Function Status(qry As String) As String
Dim db As DAO.Database
Dim rs As ADODB.Recordset
Dim sResult As String
On Error GoTo ProcErr
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM Relevos WHERE PK_Proceso =" & qry & " ;")
sResult = "Bing"
Status2 = sResult
CleanUp:
Set rs = Nothing
Set oConn = Nothing
Exit Function
' End Select
ProcErr:
' insert error handler
Resume CleanUp
End Function
I just want a column that shows "bing" for everyrow, because I am trying to check my code, but the thing is if I set the rs it comes empty. If I delete the Setting for the rs, then It shows "bing".
The idea was that the function should check the content from the different fields in the query recordset and return a value based on that, but if I can't even get it to show thins that should always be displayed I am doing something wrong.
Any idea? I can't understand why it came empty.