R
ryguy7272
I know my SQL works. I used SQL to VBA to convert it to VBA, but now part of
the string so too long in the VBE that it causes and error. Here's the SQL:
strSql = "SELECT SharePrices.DateTime, SharePrices.StockSymbol,
SharePrices.StockPrice, tblStocksGroup.Company, tblStocksGroup.Group,
tblStocksGroup.Class, tblStocksGroup.HDVest50k, tblStocksGroup.HDVetst100k,
tblStocksGroup.ETF, tblStocksGroup.NetJets, tblStocksGroup.JetBlue,
tblStocksGroup.JetBlueTradeLink, tblStocksGroup.AirWisconsin,
tblStocksGroup.Alaska, tblStocksGroup.American, tblStocksGroup.Continental,
tblStocksGroup.Delta, tblStocksGroup.Frontier, tblStocksGroup.Southwest,
tblStocksGroup.UnitedFAS, tblStocksGroup.UnitedPilots,
tblStocksGroup.WorldAirway, tblStocksGroup.LeveragedLong,
tblStocksGroup.LeveragedShort, tblStocksGroup.Other1, tblStocksGroup.Other2 "
& vbCrLf & _
"FROM SharePrices INNER JOIN tblStocksGroup ON SharePrices.StockSymbol =
tblStocksGroup.Ticker " & vbCrLf & _
"WHERE (((tblStocksGroup.Group)=[Forms]![frmMaster]![cboGroup]) AND
((tblStocksGroup.Class)=[Forms]![frmMaster]![cboClass]) AND
((tblStocksGroup.HDVest50k) Like
IIf([Forms]![frmMaster]![chkVest50K]=-1,""*"",""HDVest50K"")) AND
((tblStocksGroup.HDVetst100k) Like
IIf([Forms]![frmMaster]![chkHDVetst100k]=-1,""*"",""HDVetst100k"")) AND
((tblStocksGroup.ETF) Like
IIf([Forms]![frmMaster]![chkETF]=-1,""*"",""ETF"")) AND
((tblStocksGroup.NetJets) Like
IIf([Forms]![frmMaster]![chkNetJets]=-1,""*"",""NetJets"")) AND
((tblStocksGroup.JetBlue) Like
IIf([Forms]![frmMaster]![chkJetBlue]=-1,""*"",""JetBlue"")) AND
((tblStocksGroup.JetBlueTradeLink) Like
IIf([Forms]![frmMaster]![chkJetBlueTradeLink]=-1,""*"",""JetBlueTradeLink""))
AND ((tblStocksGroup.AirWisconsin) Like
IIf([Forms]![frmMaster]![chkAirWisconsin]=-1,""*"",""AirWisconsin"")) AND
((tblStocksGroup.Alaska) Like
IIf([Forms]![frmMaster]![chkAlaska]=-1,""*"",""Alaska"")) AND
((tblStocksGroup.American) Like
IIf([Forms]![frmMaster]![chkAmerican]=-1,""*"",""American"")) AND
((tblStocksGroup.Continental) Like
IIf([Forms]![frmMaster]![chkContinental]=-1,""*"",""Continental"")) AND
((tblStocksGroup.Delta) Like
IIf([Forms]![frmMaster]![chkDelta]=-1,""*"",""Delta"")) AND
((tblStocksGroup.Frontier) Like
IIf([Forms]![frmMaster]![chkDelta]=-1,""*"",""Delta"")) AND
((tblStocksGroup.Southwest) Like
IIf([Forms]![frmMaster]![chkSouthwest]=-1,""*"",""Southwest"")) AND
((tblStocksGroup.UnitedFAS) Like
IIf([Forms]![frmMaster]![chkUnitedFAS]=-1,""*"",""UnitedFAS"")) AND
((tblStocksGroup.UnitedPilots) Like
IIf([Forms]![frmMaster]![chkUnitedPilots]=-1,""*"",""UnitedPilots"")) AND
((tblStocksGroup.WorldAirway) Like
IIf([Forms]![frmMaster]![chkWorldAirway]=-1,""*"",""WorldAirway"")) AND
((tblStocksGroup.LeveragedLong) Like
IIf([Forms]![frmMaster]![chkLeveragedLong]=-1,""*"",""LeveragedLong"")) AND
((tblStocksGroup.LeveragedShort) Like
IIf([Forms]![frmMaster]![chkLeveragedShort]=-1,""*"",""LeveragedShort"")) AND
((tblStocksGroup.Other1) Like
IIf([Forms]![frmMaster]![chkLeveragedOther1]=-1,""*"",""LeveragedOther1""))
AND ((tblStocksGroup.Other2) Like
IIf([Forms]![frmMaster]![chkLeveragedOther2]=-1,""*"",""LeveragedOther2"")))
" & vbCrLf & _
"ORDER BY SharePrices.DateTime;"
Where can I put in logical breaks to I can make this work in the VBE? I
tried this:
& vbCrLf & _
Tried it before the 'Like' and I tried before the 'AND'; nothing has worked
thus far. There must e a pretty easy way to break this up though, right.
Appreciate any help with this.
Thanks!
Ryan--
the string so too long in the VBE that it causes and error. Here's the SQL:
strSql = "SELECT SharePrices.DateTime, SharePrices.StockSymbol,
SharePrices.StockPrice, tblStocksGroup.Company, tblStocksGroup.Group,
tblStocksGroup.Class, tblStocksGroup.HDVest50k, tblStocksGroup.HDVetst100k,
tblStocksGroup.ETF, tblStocksGroup.NetJets, tblStocksGroup.JetBlue,
tblStocksGroup.JetBlueTradeLink, tblStocksGroup.AirWisconsin,
tblStocksGroup.Alaska, tblStocksGroup.American, tblStocksGroup.Continental,
tblStocksGroup.Delta, tblStocksGroup.Frontier, tblStocksGroup.Southwest,
tblStocksGroup.UnitedFAS, tblStocksGroup.UnitedPilots,
tblStocksGroup.WorldAirway, tblStocksGroup.LeveragedLong,
tblStocksGroup.LeveragedShort, tblStocksGroup.Other1, tblStocksGroup.Other2 "
& vbCrLf & _
"FROM SharePrices INNER JOIN tblStocksGroup ON SharePrices.StockSymbol =
tblStocksGroup.Ticker " & vbCrLf & _
"WHERE (((tblStocksGroup.Group)=[Forms]![frmMaster]![cboGroup]) AND
((tblStocksGroup.Class)=[Forms]![frmMaster]![cboClass]) AND
((tblStocksGroup.HDVest50k) Like
IIf([Forms]![frmMaster]![chkVest50K]=-1,""*"",""HDVest50K"")) AND
((tblStocksGroup.HDVetst100k) Like
IIf([Forms]![frmMaster]![chkHDVetst100k]=-1,""*"",""HDVetst100k"")) AND
((tblStocksGroup.ETF) Like
IIf([Forms]![frmMaster]![chkETF]=-1,""*"",""ETF"")) AND
((tblStocksGroup.NetJets) Like
IIf([Forms]![frmMaster]![chkNetJets]=-1,""*"",""NetJets"")) AND
((tblStocksGroup.JetBlue) Like
IIf([Forms]![frmMaster]![chkJetBlue]=-1,""*"",""JetBlue"")) AND
((tblStocksGroup.JetBlueTradeLink) Like
IIf([Forms]![frmMaster]![chkJetBlueTradeLink]=-1,""*"",""JetBlueTradeLink""))
AND ((tblStocksGroup.AirWisconsin) Like
IIf([Forms]![frmMaster]![chkAirWisconsin]=-1,""*"",""AirWisconsin"")) AND
((tblStocksGroup.Alaska) Like
IIf([Forms]![frmMaster]![chkAlaska]=-1,""*"",""Alaska"")) AND
((tblStocksGroup.American) Like
IIf([Forms]![frmMaster]![chkAmerican]=-1,""*"",""American"")) AND
((tblStocksGroup.Continental) Like
IIf([Forms]![frmMaster]![chkContinental]=-1,""*"",""Continental"")) AND
((tblStocksGroup.Delta) Like
IIf([Forms]![frmMaster]![chkDelta]=-1,""*"",""Delta"")) AND
((tblStocksGroup.Frontier) Like
IIf([Forms]![frmMaster]![chkDelta]=-1,""*"",""Delta"")) AND
((tblStocksGroup.Southwest) Like
IIf([Forms]![frmMaster]![chkSouthwest]=-1,""*"",""Southwest"")) AND
((tblStocksGroup.UnitedFAS) Like
IIf([Forms]![frmMaster]![chkUnitedFAS]=-1,""*"",""UnitedFAS"")) AND
((tblStocksGroup.UnitedPilots) Like
IIf([Forms]![frmMaster]![chkUnitedPilots]=-1,""*"",""UnitedPilots"")) AND
((tblStocksGroup.WorldAirway) Like
IIf([Forms]![frmMaster]![chkWorldAirway]=-1,""*"",""WorldAirway"")) AND
((tblStocksGroup.LeveragedLong) Like
IIf([Forms]![frmMaster]![chkLeveragedLong]=-1,""*"",""LeveragedLong"")) AND
((tblStocksGroup.LeveragedShort) Like
IIf([Forms]![frmMaster]![chkLeveragedShort]=-1,""*"",""LeveragedShort"")) AND
((tblStocksGroup.Other1) Like
IIf([Forms]![frmMaster]![chkLeveragedOther1]=-1,""*"",""LeveragedOther1""))
AND ((tblStocksGroup.Other2) Like
IIf([Forms]![frmMaster]![chkLeveragedOther2]=-1,""*"",""LeveragedOther2"")))
" & vbCrLf & _
"ORDER BY SharePrices.DateTime;"
Where can I put in logical breaks to I can make this work in the VBE? I
tried this:
& vbCrLf & _
Tried it before the 'Like' and I tried before the 'AND'; nothing has worked
thus far. There must e a pretty easy way to break this up though, right.
Appreciate any help with this.
Thanks!
Ryan--