In the code below, what I am trying to do is to determine what the value of str_All should be. And then trying to set @strAll = str_All so that I could use it in my SQL.
Question: How can I do something like this?
Dim str_All As String
If chkCustomersWithOrders.Checked Then
str_All = "(have orders)"
str_All = "(some have orders)"
SQL.ExecQuery("SELECT CustomerID, substring(FirstName + ' ' + LastName + ' ',1,50) +" & " dbo.fnHasOrders (CustomerID) as CustName From tblCustomers Union" & _
" SELECT '99999', '<All>' + @strAll From tblCustomers")