My Access 2007 table holds 25 groups of trip records. The individual group records are sequentially numbered trip leg record sets, such as: 1.01, 1.02. . .etc. for the for as many legs for the first group, 2.01, 202...etc. for the second group and so on for all 25 groups.
Objective: Select any number from 1 to 25, from a combobox control's list, on a form, and open a report that displays all of the leg's records for that number (ie., trip).
Problem: When I select 1, for example, the report displays records (grouped) for 1, 10 thru 19 and when I pick 2, the report displays records for 2, 20 thru 25. However, when I pick 2 thru 9,
the reports display correctly. I want to be able to display on the records associated with the number that I pick.
Question: What additional code is required to facilitate what I want to happen in my routine shown below?
-----
Private Sub cboTrips_lbl_AfterUpdate()
Dim strReport As String
Dim lngView As Long
strReport = "rptTrips_By_TN" 'names the report to display
T_TN = [Forms]![frmReport_Selector]![cboTrips_lbl] 'gets the trip number
'Close the report if already open: otherwise it won't filter properly.
If CurrentProject.AllReports(strReport).IsLoaded Then
DoCmd.Close acReport, strReport
End If
lngView = acViewPreview 'Use acViewNormal to print instead of preview.
'Open the report to display the selected trip group using DBGuy's code
DoCmd.OpenReport strReport, acViewPreview, , "[T_TN] Like '" & Me.cboTrips_lbl & "*'"
End Sub
Objective: Select any number from 1 to 25, from a combobox control's list, on a form, and open a report that displays all of the leg's records for that number (ie., trip).
Problem: When I select 1, for example, the report displays records (grouped) for 1, 10 thru 19 and when I pick 2, the report displays records for 2, 20 thru 25. However, when I pick 2 thru 9,
the reports display correctly. I want to be able to display on the records associated with the number that I pick.
Question: What additional code is required to facilitate what I want to happen in my routine shown below?
-----
Private Sub cboTrips_lbl_AfterUpdate()
Dim strReport As String
Dim lngView As Long
strReport = "rptTrips_By_TN" 'names the report to display
T_TN = [Forms]![frmReport_Selector]![cboTrips_lbl] 'gets the trip number
'Close the report if already open: otherwise it won't filter properly.
If CurrentProject.AllReports(strReport).IsLoaded Then
DoCmd.Close acReport, strReport
End If
lngView = acViewPreview 'Use acViewNormal to print instead of preview.
'Open the report to display the selected trip group using DBGuy's code
DoCmd.OpenReport strReport, acViewPreview, , "[T_TN] Like '" & Me.cboTrips_lbl & "*'"
End Sub