R
ryguy7272
For the past four hours I’ve been at this; still no solution! Argh!! I now
yield to the SQL experts. I have two small loops that run through a ListBox
and do some nice string concatenations for me:
For Each varItem In Me.lstTrader.ItemsSelected
strTrader = strTrader & ",'" & Me.lstTrader.ItemData(varItem) & "'"
Next varItem
If Len(strTrader) > 0 Then
strTrader = Right(strTrader, Len(strTrader) - 1)
strTrader = "IN(" & strTrader & ")"
End If
That works fine! I have the following VBA, which also works fine:
strSQL = "SELECT * FROM Trades " & _
"WHERE (Trades.[TDATE] Between [Forms]![QueryForm]![cboFrom]
And [Forms]![QueryForm]![cboTo]) And " & _
"(Trades.[Cust] " & strCust & strTraderCondition &
"Trades.[Trader] " & strTrader & ");"
Now, I’m trying to add something to the VBA to allow me to get a value from
here:
[Forms]![QueryForm]![cboSymbol]
If I have IBM in my cboSymbol, I want to past it to my query. If nothing is
selected in cboSymbol, then I want to see all symbols in my query.
I thought it would be something like this, but no:
“(([Forms]![QueryForm]![cboSymbol] & "") Like '*') And “ & _
This causes and error too:
"[Forms]![QueryForm]![cboSymbol] & "" Like
Nz([Forms]![QueryForm]![CboSymbol]," * ") And " & _
I keep getting these run time errors, or type mismatch errors. Very
annoying!! If someone can please take a look at this and let me know what to
do, I’d be most appreciative!!
Thanks, as always,
Ryan---
yield to the SQL experts. I have two small loops that run through a ListBox
and do some nice string concatenations for me:
For Each varItem In Me.lstTrader.ItemsSelected
strTrader = strTrader & ",'" & Me.lstTrader.ItemData(varItem) & "'"
Next varItem
If Len(strTrader) > 0 Then
strTrader = Right(strTrader, Len(strTrader) - 1)
strTrader = "IN(" & strTrader & ")"
End If
That works fine! I have the following VBA, which also works fine:
strSQL = "SELECT * FROM Trades " & _
"WHERE (Trades.[TDATE] Between [Forms]![QueryForm]![cboFrom]
And [Forms]![QueryForm]![cboTo]) And " & _
"(Trades.[Cust] " & strCust & strTraderCondition &
"Trades.[Trader] " & strTrader & ");"
Now, I’m trying to add something to the VBA to allow me to get a value from
here:
[Forms]![QueryForm]![cboSymbol]
If I have IBM in my cboSymbol, I want to past it to my query. If nothing is
selected in cboSymbol, then I want to see all symbols in my query.
I thought it would be something like this, but no:
“(([Forms]![QueryForm]![cboSymbol] & "") Like '*') And “ & _
This causes and error too:
"[Forms]![QueryForm]![cboSymbol] & "" Like
Nz([Forms]![QueryForm]![CboSymbol]," * ") And " & _
I keep getting these run time errors, or type mismatch errors. Very
annoying!! If someone can please take a look at this and let me know what to
do, I’d be most appreciative!!
Thanks, as always,
Ryan---