This seems to be a common question but I can't get it to work with any of the suggestions I have seen. Here is my problem.
My row source is a query bound to the ID in column 1. I want the Client Name in column 2. In the red highlighted portion of the code, if I leave the .column(2) off, my result is the ID number of the client. Once I add the eval() and .column(2), I get an error "invalid use of null".
What have I done wrong? I left out the rest of the code since this is where my problem lies.
My row source is a query bound to the ID in column 1. I want the Client Name in column 2. In the red highlighted portion of the code, if I leave the .column(2) off, my result is the ID number of the client. Once I add the eval() and .column(2), I get an error "invalid use of null".
What have I done wrong? I left out the rest of the code since this is where my problem lies.
Code:
Private Sub butSendEMail_Click()
On Error GoTo butSendEMail_Click_Err
Dim varTo As Variant '-- Address for SendObject
Dim stSubject As String '-- Subject line of e-mail
Dim stUserName As String '-- Person who assigned ticket
Dim stCName As String '-- Name of client
Dim stCNum As String '-- Client number
Dim stText As String '-- E-mail text
'-- Email address to send email to
varTo = [EMAIL="test@test.com"]test@test.com[/EMAIL]
'-- Subject line of email
stSubject = ":: Bookkeeping task completed ::"
'-- Employee who is sending message
stUserName = Forms!frmLogin!txtLoginFN
'-- Determine client name
[COLOR=red] stCName = Eval(Forms!frmMyTasks!sfrmMyTasks.Form.ClientName.Column(2))[/COLOR]