tags:

views:

509

answers:

1

I have a button that is opening a report. I have a statement in the "where" clause to only show a ToteLocation that matches the location in a field on the current form. Here is the code:

Private Sub         
    cbTruckorder_Click()
    Dim stdocname As Stringstdocname = "TruckLoadingReport"
    ' setting focus to ScannerRead in order to continue operations 
    '      (see Command22)
    Me.tbScannerRead.SetFocus
    ' opening the Truck Loading Report
    DoCmd.OpenReport stdocname, acViewPreview, , "[Tote Log].ToteLocation =" & _
                                                            Me.tbScannerRead
End Sub

I am getting a message box that is asking for a parameter value. In the box it is showing the value of Me.tbScannerRead. For example: T265. The report is very simple and has the totelocation text box in the page header and the information is grouped by a Lot number, in the lot number header I have a text box for Lot number. I the details I have the tote numbers text box and that is it, nothing more.

If I put in the value (T265) in the parameter value it will show the report, but I need the parameter value box to disappear, any suggestions from anyone would be nice.

Thank you

Here is the SQL for the Report:

SELECT [Tote Log].Type, 
        [Tote Log].Number, 
        [Tote Log].ToteLocation, 
        [Lot Number].Lot
FROM [Tote Log] INNER JOIN [Lot Number] 
        ON [Tote Log].[Lot Number] = [Lot Number].ID;
+1  A: 
Private Sub         
    cbTruckorder_Click()       
    Dim stdocname As Stringstdocname = "TruckLoadingReport"        
    ' setting focus to ScannerRead in order to continue operations 
    '     (see Command22) 
    Me.tbScannerRead.SetFocus   
    ' opening the Truck Loading Report 
    DoCmd.OpenReport stdocname, acViewPreview, , "[Tote Log].ToteLocation ='" & _
                                                        Me.tbScannerRead & "'" 
End Sub

I can't remember his last name, but thank you Jeff it really helped. I added the single quotes but took out the .text after ME.tbScannerRead. Thanks Again

gary A.K.A. G4