Unanswered: Problem with Function that is to return results of a Query - getting a compile error
Thank you in advance for your help!
I have created a function that is supposed to return the Client Name. The input to the function is the Client ID number. I am testing the function in the immediate window and I am getting the compile error "Expected variable or procedure, not module" . My code is below, what am I doing wrong?
Public Function ClientNameText(ClientNbr As Integer) As String
Dim Conn As ADODB.Connection
Set Conn = CurrentProject.Connection
Dim rs As New ADODB.Recordset
rs.ActiveConnection = Conn
rs.Open "select clientname from client where clientid = clientnbr ;"