Selasa, 23 Februari 2016

RE: [MS_AccessPros] Need help with a Report


Hi Kat,
I almost always write some code to open the report from a button on the form. You can use the command button wizard to start the code and then modify based on your control and field names and data types.
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtEmpName) Then
    strWhere = strWhere & " AND [EmpNameColumn] =""" & Me.txtEmpName & """ "
End If
If Not IsNull(Me.txtDept) Then
    strWhere = strWhere & " AND [DeptColumn] = """ &  Me.txtDept & """ "
End If
'  add more controls and where conditions
DoCmd.OpenReport "rptYourReportName", acViewPreview, , strWhere
If you have questions you should come back with actual control and field names as well as data types.
Duane Hookom, MVP
MS Access

Date: Tue, 23 Feb 2016 14:59:07 -0800
Subject: [MS_AccessPros] Need help with a Report

Hi Everyone!
I have a form that has several option buttons, it also includes some unbound combo boxes for employee name, department, training class, etc.  I have a report which includes all this information.  What I would like to do is have the report print for a specific employee. Currently, if I select an employee and a training class, and click on the option button for Report for Specific Employee, the report opens for all employees, and not the one specified.  What do I need to do to have the report run for the selected filters?
Any help is greatly appreciated!!!


Posted by: Duane Hookom <>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)



Tidak ada komentar:

Posting Komentar