Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Dynamic RecordSource too long 1

Status
Not open for further replies.

kermitforney

Technical User
Mar 15, 2005
374
US
Access 2002

Having an issue when trying to pass a string variable to a sub forms recordsource property.

Error:
Run-time error '103':
the identifier that starts with 'partial query string' is too long. Maximum length is 128.

Any insight.

Code:
Dim strVendorCriteria       As String
    Dim strWarehouseCriteria    As String
    Dim strDateCriteria         As String
    Dim strStatusCriteria       As String
    Dim strBuyerCriteria        As String
    Dim strSQL                  As String
    
    
    strVendorCriteria = fstrGetVendorCriteria
    strBuyerCriteria = fstrGetBuyerCriteria
    strItemCriteria = fstrGetItemCriteria
    strWarehouseCriteria = fstrGetWarehouseCriteria
    strStatusCriteria = fstrGetStatusCriteria
    strItemSourceCriteria = fstrGetItemSourceCriteria
    
    strSQL = " UPDATE  [ATA2].[dbo].[tblItemForecastWeekly] "
    strSQL = strSQL + " Set [FutureForecast1] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast2] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast3] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast4] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast5] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast6] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast7] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast8] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast9] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast10] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast11] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast12] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast13] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast14] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast15] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " ,[FutureForecast16] = [tblItemForecastWeekly].[Avg. Shipped last 4 weeks] "
    strSQL = strSQL + " FROM (SELECT * FROM tblItemForecastWeekly WHERE "






 strSQL = strSQL + " ) AS UpdateFcst WHERE    tblItemForecastWeekly.lngItemForecastWeeklyID = UpdateFcst.lngItemForecastWeeklyID "
    

    Me![FrmRptBuyingForecasting_ItemData].Form.RecordSource = strSQL
    Me.Requery
                
  Else
  End If

The above is only a portion of the code for examples sake, I have tested the generated query and it works fine. The error is sent when trying to aaply the strSQL string to the RecordSource.

Thanks, in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top