A
Anne
Below I have the code for 2 print selections. In the first one, the user
selects on Employee from a combo box. I would like to replace combox
selection with a selections form a list box, see 2nd sample.
Any help would be appreciated
Anne
Private Sub Print1_Click()
Dim strWhere As String
strWhere = "True" ' so records will be retrieved if no other
' criteria are entered
If Not IsNull(Me!cboMoveTo) Then
strWhere = strWhere & " AND [EmployeeID] = " & Me!cboMoveTo
End If
If Not IsNull(Me!txtDateFrom) Then
strWhere = strWhere & " AND [WeDate] >= #" & _
CDate(Me!txtDateFrom) & "#"
End If
If Not IsNull(Me!txtDateTo) Then
strWhere = strWhere & " AND [WeDate] <= #" & _
CDate(Me!txtDateTo) & "#"
End If
DoCmd.OpenReport "5AnyWeekDetailbyEmplCboDates", acViewPreview, , strWhere
DoCmd.RunCommand acCmdZoom75
End Sub
--------------
Private Sub cmdPrint_Click()
Dim varSelected As Variant
Dim strSQL As String
For Each varSelected In Me!lstSelect.ItemsSelected
strSQL = strSQL & Me!lstSelect.ItemData(varSelected) & ","
Next varSelected
If strSQL <> "" Then
strSQL = "[EmployeeID] IN (" & Left(strSQL, Len(strSQL) - 1) & ")"
DoCmd.OpenReport "rptEntry", acViewNormal, , strSQL
End If
End Sub
selects on Employee from a combo box. I would like to replace combox
selection with a selections form a list box, see 2nd sample.
Any help would be appreciated
Anne
Private Sub Print1_Click()
Dim strWhere As String
strWhere = "True" ' so records will be retrieved if no other
' criteria are entered
If Not IsNull(Me!cboMoveTo) Then
strWhere = strWhere & " AND [EmployeeID] = " & Me!cboMoveTo
End If
If Not IsNull(Me!txtDateFrom) Then
strWhere = strWhere & " AND [WeDate] >= #" & _
CDate(Me!txtDateFrom) & "#"
End If
If Not IsNull(Me!txtDateTo) Then
strWhere = strWhere & " AND [WeDate] <= #" & _
CDate(Me!txtDateTo) & "#"
End If
DoCmd.OpenReport "5AnyWeekDetailbyEmplCboDates", acViewPreview, , strWhere
DoCmd.RunCommand acCmdZoom75
End Sub
--------------
Private Sub cmdPrint_Click()
Dim varSelected As Variant
Dim strSQL As String
For Each varSelected In Me!lstSelect.ItemsSelected
strSQL = strSQL & Me!lstSelect.ItemData(varSelected) & ","
Next varSelected
If strSQL <> "" Then
strSQL = "[EmployeeID] IN (" & Left(strSQL, Len(strSQL) - 1) & ")"
DoCmd.OpenReport "rptEntry", acViewNormal, , strSQL
End If
End Sub