i have a report which it's data source is a select query
and I have a form with a combo box the data source is a table employee, I have chosen id and employeename
there is a button with a vba code in the on click event like below :
but it always bring the first employee and ignore the combo box selection
Code: Select all
Private Sub cmdPrtRpt_Click()
Dim strWhere As String
If Not IsNull(Me.cboEmployeeFullName) Then
stWhere = EmployeeFullName = Me.cboEmployeeFullName.Column(1)
End If
DoCmd.OpenReport REPORTNAME:="rptEmployee", view:=acViewReport, WhereCondition:=strWhere
End Sub