Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
DoCmd.Close acForm, Me.Name ' Close the current form.
If Me.chkFinal = True Then
strWhere = strWhere & " AND boolfield=true" ' replace 'boolfield' with your field name
End If
If Len (Me.txtStringfield & "") > 0 Then
strWhere = strWhere & " AND textfield = '" & me.txtTextfield & "'"
End If
If Len (Me.txtField & "") > 0 Then
strWhere = strWhere & " AND numfield = " & me.txtNumericField
End If
If Len (Me.txtField & "") > 0 Then
strWhere = strWhere & " AND datefield = #" & Me.txtDateField & "#"
End If
If Len (Me.txtFromdate & "") >0 And Len (Me.txtToDate & "") >0 Then
' entries in both
strWhere = strWhere & " AND datefield Between #" & me.txtFromDate & "# AND #" & me.txtToDate & "#"
Else If Len (Me.txtFromdate & "") >0 And Len (Me.txtToDate & "") =0 Then
' user put something in From date only
strWhere = strWhere & " AND datefield >= #" & Me.txtFromDate & "#"
Else If Len (Me.txtFromDate & "") =0 And Len (Me.txtToDate & "") > 0 Then
' user put something in to date only
strWhere = strWhere & " AND datefield <= #" & Me.txtFromDate & "#"
End If ' no need to specify anything if nothing selected
Private Sub cmdRunReport_Click()
Dim strWhere as String 'String variable to store where clause
' the rest of the code goes in here
'
If Len (strWhere & "") = 0 Then
' no options selected. Open report with no where condition
DoCmd.OpenReport "Reportname", acViewPreview
Else
' remove first "AND" from where condition and pass across to report
DoCmd.OpenReport "Reportname", acViewPreview, WhereCondition := Mid (strWhere, 6)
End If
End Sub