HI...
Is there a limit on to how long an SQL query can be???
I have the following query which gives a TOO LONG error.
I´ve used & vbCrLf which I found in one of the threads, however it doesn´t seem to help...
ANy ideas...
lafecha = Format(Date, "mm/dd/yyyy"
sqlline = sqlline & "SELECT [Global Buying Rates].ShippingID, [Global Buying Rates].ValidDate, [Global Buying Rates].ToDate,"
sqlline = sqlline & "[Global Buying Rates].GRI,[Global Buying Rates].Service, [Global Buying Rates].Frequency,[Global Buying Rates].Commodity,"
sqlline = sqlline & "[Global Buying Rates].Type, [Global Buying Rates].POL, [Global Buying Rates].POD, [Global Buying Rates].[20Freight], "
sqlline = sqlline & "[Global Buying Rates].[20FreightCUR], [Global Buying Rates].[40Freight],[Global Buying Rates].[40FreightCUR], [Global Buying Rates].[FAC],"
sqlline = sqlline & "[Global Buying Rates].[Incentive], [Global Buying Rates].[Id],[20Freight]*((100-nz([FAC]))/100)-nz([Incentive]) AS txt20FreightVIP,"
sqlline = sqlline & "" & """" & "Global Buying Rates" & """" & " AS TabletoLook",[40Freight]*((100-nz([FAC]))/100)-nz([Incentive]) AS txt40FreightVIP
sqlline = sqlline & " FROM [Global Buying Rates]"
sqlline = sqlline & " WHERE ((([Global Buying Rates].ShippingID)" & txtShippingLine & ""
sqlline = sqlline & " AND (([Global Buying Rates].Type)" & txttype & ""
sqlline = sqlline & " AND (([Global Buying Rates].ToDate)=#" & lafecha & "# Or ([Global Buying Rates].ToDate)>#" & lafecha & "# Or ([Global Buying Rates].ToDate) Is Null) "
sqlline = sqlline & " AND (([Global Buying Rates].POL)" & txtPOL & " "
sqlline = sqlline & " AND (([Global Buying Rates].POD)" & txtPOD & ") " & vbCrLf
sqlline = sqlline & " UNION ALL "
sqlline = sqlline & "SELECT [Local Buying Rates].ShippingID, [Local Buying Rates].ValidDate, [Local Buying Rates].ToDate,"
sqlline = sqlline & "[Local Buying Rates].GRI,[Local Buying Rates].Service, [Local Buying Rates].Frequency,[Local Buying Rates].Commodity,"
sqlline = sqlline & "[Local Buying Rates].Type, [Local Buying Rates].POL, [Local Buying Rates].POD, [Local Buying Rates].[20Freight], "
sqlline = sqlline & "[Local Buying Rates].[20FreightCUR], [Local Buying Rates].[40Freight],[Local Buying Rates].[40FreightCUR], [Local Buying Rates].[FAC],"
sqlline = sqlline & "[Local Buying Rates].[Incentive], [Local Buying Rates].[Id],[20Freight]*((100-nz([FAC]))/100)-nz([Incentive]) AS txt20FreightVIP,"
sqlline = sqlline & " " & """" & "Global Buying Rates" & """" & " AS TabletoLook",[40Freight]*((100-nz([FAC]))/100)-nz([Incentive]) AS txt40FreightVIP,
sqlline = sqlline & " FROM [Local Buying Rates]"
sqlline = sqlline & " WHERE ((([Local Buying Rates].ShippingID)" & txtShippingLine & ""
sqlline = sqlline & " AND (([Local Buying Rates].Type)" & txttype & ""
sqlline = sqlline & " AND (([Local Buying Rates].ToDate)=#" & lafecha & "# Or ([Local Buying Rates].ToDate)>#" & lafecha & "# Or ([Local Buying Rates].ToDate) Is Null) "
sqlline = sqlline & " AND (([Local Buying Rates].POL)" & txtPOL & " "
sqlline = sqlline & " AND (([Local Buying Rates].POD)" & txtPOD & ")" & CheaptoExpensive & ";"
mas:
Me.RecordSource = sqlline
Is there a limit on to how long an SQL query can be???
I have the following query which gives a TOO LONG error.
I´ve used & vbCrLf which I found in one of the threads, however it doesn´t seem to help...
ANy ideas...
lafecha = Format(Date, "mm/dd/yyyy"
sqlline = sqlline & "SELECT [Global Buying Rates].ShippingID, [Global Buying Rates].ValidDate, [Global Buying Rates].ToDate,"
sqlline = sqlline & "[Global Buying Rates].GRI,[Global Buying Rates].Service, [Global Buying Rates].Frequency,[Global Buying Rates].Commodity,"
sqlline = sqlline & "[Global Buying Rates].Type, [Global Buying Rates].POL, [Global Buying Rates].POD, [Global Buying Rates].[20Freight], "
sqlline = sqlline & "[Global Buying Rates].[20FreightCUR], [Global Buying Rates].[40Freight],[Global Buying Rates].[40FreightCUR], [Global Buying Rates].[FAC],"
sqlline = sqlline & "[Global Buying Rates].[Incentive], [Global Buying Rates].[Id],[20Freight]*((100-nz([FAC]))/100)-nz([Incentive]) AS txt20FreightVIP,"
sqlline = sqlline & "" & """" & "Global Buying Rates" & """" & " AS TabletoLook",[40Freight]*((100-nz([FAC]))/100)-nz([Incentive]) AS txt40FreightVIP
sqlline = sqlline & " FROM [Global Buying Rates]"
sqlline = sqlline & " WHERE ((([Global Buying Rates].ShippingID)" & txtShippingLine & ""
sqlline = sqlline & " AND (([Global Buying Rates].Type)" & txttype & ""
sqlline = sqlline & " AND (([Global Buying Rates].ToDate)=#" & lafecha & "# Or ([Global Buying Rates].ToDate)>#" & lafecha & "# Or ([Global Buying Rates].ToDate) Is Null) "
sqlline = sqlline & " AND (([Global Buying Rates].POL)" & txtPOL & " "
sqlline = sqlline & " AND (([Global Buying Rates].POD)" & txtPOD & ") " & vbCrLf
sqlline = sqlline & " UNION ALL "
sqlline = sqlline & "SELECT [Local Buying Rates].ShippingID, [Local Buying Rates].ValidDate, [Local Buying Rates].ToDate,"
sqlline = sqlline & "[Local Buying Rates].GRI,[Local Buying Rates].Service, [Local Buying Rates].Frequency,[Local Buying Rates].Commodity,"
sqlline = sqlline & "[Local Buying Rates].Type, [Local Buying Rates].POL, [Local Buying Rates].POD, [Local Buying Rates].[20Freight], "
sqlline = sqlline & "[Local Buying Rates].[20FreightCUR], [Local Buying Rates].[40Freight],[Local Buying Rates].[40FreightCUR], [Local Buying Rates].[FAC],"
sqlline = sqlline & "[Local Buying Rates].[Incentive], [Local Buying Rates].[Id],[20Freight]*((100-nz([FAC]))/100)-nz([Incentive]) AS txt20FreightVIP,"
sqlline = sqlline & " " & """" & "Global Buying Rates" & """" & " AS TabletoLook",[40Freight]*((100-nz([FAC]))/100)-nz([Incentive]) AS txt40FreightVIP,
sqlline = sqlline & " FROM [Local Buying Rates]"
sqlline = sqlline & " WHERE ((([Local Buying Rates].ShippingID)" & txtShippingLine & ""
sqlline = sqlline & " AND (([Local Buying Rates].Type)" & txttype & ""
sqlline = sqlline & " AND (([Local Buying Rates].ToDate)=#" & lafecha & "# Or ([Local Buying Rates].ToDate)>#" & lafecha & "# Or ([Local Buying Rates].ToDate) Is Null) "
sqlline = sqlline & " AND (([Local Buying Rates].POL)" & txtPOL & " "
sqlline = sqlline & " AND (([Local Buying Rates].POD)" & txtPOD & ")" & CheaptoExpensive & ";"
mas:
Me.RecordSource = sqlline