Yes I closed the report and repopened it.The code I posted worked correctly in the sample db. Did you have the report in Report view?
Works fine for me. I didn't ask if you closed it, I asked if it was open in Report view (as opposed to Preview). If I open your report in Report view and click inside the 16 Weeks textbox, the 2 records with that value disappear.
Okay now I understand.The way you have it set up, they show up until you click in that field. That's what your code does. If you don't want to see them from the start, use the code in the form to open it without them. Alternatively, you can put that code in the form's open or load event.
Private Sub ReportBtn_Click()
'MsgBox ("This feature is not complete yet sorry")
Dim rptStr As String
rptStr = "t_asset_master.ASSIGNED_TO = '" & Me.ReportPersonnelCombo & "'"
If Len(ReportPersonnelCombo.Value & vbNullString) > 0 Then
DoCmd.OpenReport "PersonalAssetReport", acViewPreview, , rptStr, acWindowNormal
Else
MsgBox ("Please select the name from the list box of the person you want to generate the report for")
End If
End Sub
SELECT "" AS[LAST NAME], "" AS [FIRST NAME], t_asset_master.ASSET_MASTER_PHY_ID, valid_type.CODE AS TYPE, t_asset_master.BARCODE, valid_manuf.CODE AS MANUFACTURER, t_asset_master.MODEL
FROM ((t_asset_master INNER JOIN t_asset_personnel ON t_asset_master.ASSIGNED_TO = t_asset_personnel.USER_PHY_ID) INNER JOIN t_asset_valid AS valid_type ON t_asset_master.TYPE = valid_type.VALID_PHY_ID) INNER JOIN t_asset_valid AS valid_manuf ON t_asset_master.MANUFACTURER = valid_manuf.VALID_PHY_ID
UNION SELECT DISTINCT t_asset_personnel.LAST_NAME, t_asset_personnel.FIRST_NAME, NULL, NULL, NULL, NULL, NULL
FROM (t_asset_master INNER JOIN t_asset_personnel ON t_asset_master.ASSIGNED_TO = t_asset_personnel.USER_PHY_ID);
SELECT "" AS[LAST NAME], "" AS [FIRST NAME], t_asset_master.ASSET_MASTER_PHY_ID, valid_type.CODE AS TYPE, t_asset_master.BARCODE, valid_manuf.CODE AS MANUFACTURER, t_asset_master.MODEL
FROM ((t_asset_master INNER JOIN t_asset_personnel ON t_asset_master.ASSIGNED_TO = t_asset_personnel.USER_PHY_ID) INNER JOIN t_asset_valid AS valid_type ON t_asset_master.TYPE = valid_type.VALID_PHY_ID) INNER JOIN t_asset_valid AS valid_manuf ON t_asset_master.MANUFACTURER = valid_manuf.VALID_PHY_ID
WHERE t_asset_master.ASSIGNED_TO = '5365'
UNION SELECT DISTINCT t_asset_personnel.LAST_NAME, t_asset_personnel.FIRST_NAME, NULL, NULL, NULL, NULL, NULL
FROM (t_asset_master INNER JOIN t_asset_personnel ON t_asset_master.ASSIGNED_TO = t_asset_personnel.USER_PHY_ID)
WHERE t_asset_master.ASSIGNED_TO = '5365'
Private Sub reportBtn_Click()
Dim rptStr As String
rptStr = "'" & Me.ReportPersonnelCombo & "'"
If Len(ReportPersonnelCombo.Value & vbNullString) > 0 Then
DoCmd.OpenReport "PersonalAssetReport", acViewPreview, , rptStr, acWindowNormal
Else
MsgBox ("Please select the name from the list box of the person you want to generate the report for")
End If
End Sub
SELECT "" AS[LAST NAME], "" AS [FIRST NAME],
t_asset_master.ASSET_MASTER_PHY_ID, valid_type.CODE AS TYPE,
t_asset_master.BARCODE, valid_manuf.CODE AS MANUFACTURER,
t_asset_master.MODEL, t_asset_master.ASSIGNED_TO
FROM ((t_asset_master INNER JOIN t_asset_personnel ON
t_asset_master.ASSIGNED_TO = t_asset_personnel.USER_PHY_ID) INNER
JOIN t_asset_valid AS valid_type ON t_asset_master.TYPE =
valid_type.VALID_PHY_ID) INNER JOIN t_asset_valid AS valid_manuf ON
t_asset_master.MANUFACTURER = valid_manuf.VALID_PHY_ID
UNION SELECT DISTINCT t_asset_personnel.LAST_NAME,
t_asset_personnel.FIRST_NAME, NULL, NULL, NULL, NULL, NULL, NULL
FROM (t_asset_master INNER JOIN t_asset_personnel ON
t_asset_master.ASSIGNED_TO = t_asset_personnel.USER_PHY_ID);
SELECT "" AS[LAST NAME], "" AS [FIRST NAME],
t_asset_master.ASSET_MASTER_PHY_ID, valid_type.CODE AS TYPE,
t_asset_master.BARCODE, valid_manuf.CODE AS MANUFACTURER,
t_asset_master.MODEL,t_asset_master.ASSIGNED_TO
FROM ((t_asset_master INNER JOIN t_asset_personnel ON
t_asset_master.ASSIGNED_TO = t_asset_personnel.USER_PHY_ID) INNER
JOIN t_asset_valid AS valid_type ON t_asset_master.TYPE =
valid_type.VALID_PHY_ID) INNER JOIN t_asset_valid AS valid_manuf ON
t_asset_master.MANUFACTURER = valid_manuf.VALID_PHY_ID
UNION SELECT DISTINCT t_asset_personnel.LAST_NAME,
t_asset_personnel.FIRST_NAME, NULL, NULL, NULL, NULL, NULL,
t_asset_master.ASSIGNED_TO
FROM (t_asset_master INNER JOIN t_asset_personnel ON
t_asset_master.ASSIGNED_TO = t_asset_personnel.USER_PHY_ID);