Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

commenting out a bit of code

Status
Not open for further replies.
Jan 23, 2002
1,106
GB
hi, I have an Access form I've inherited, which has some VBA code in it.
part of this code allows the user to type into a parameter box.
I'd like to get rid of this bit of code, but don't know exactly which bit of the code to rem out without upsetting the rest of it

I'd copied it below - I'd like to get remove the DOB part, just that bit, please. My users don't need to filter on DOB anymore.

Any help is as always very much appreciated

thanks
lynne

Private Sub cmdOkay_Click()
'Working Set Variables
Dim strWhere As String 'String to Hold Where Clause.

'Check for Presence of Start and End Dates
If (Me.txtDateStart.Value <> &quot;&quot;) And (Me.txtDateEnd.Value <> &quot;&quot;) Then
'Assign Where Clause
strWhere = &quot;[DOB] Between #&quot; & Format(Me.txtDateStart, &quot;dd mmm yyyy&quot;) & &quot;# And #&quot; & Format(Me.txtDateEnd, &quot;dd mmm yyyy&quot;) & &quot;#&quot;
End If

'Open the Specified Report Applying Filter if Required.
DoCmd.OpenReport Me.cmbReport.Value, acViewPreview, &quot;&quot;, strWhere
End Sub
 
Lynne,
Private Sub cmdOkay_Click()
'Working Set Variables
Dim strWhere As String 'String to Hold Where Clause.
'because your where clause refers only to the filter on DOB - don't need this
'Check for Presence of Start and End Dates
If (Me.txtDateStart.Value <> &quot;&quot;) And (Me.txtDateEnd.Value <> &quot;&quot;) Then
'Assign Where Clause

'Assume that the dates refer to the DOB filter - Don't need this
strWhere = &quot;[DOB] Between #&quot; & Format(Me.txtDateStart, &quot;dd mmm yyyy&quot;) & &quot;# And #&quot; & Format(Me.txtDateEnd, &quot;dd mmm yyyy&quot;) & &quot;#&quot;
End If

'Open the Specified Report Applying Filter if Required.
DoCmd.OpenReport Me.cmbReport.Value, acViewPreview, &quot;&quot;, strWhere
End Sub


Try this

Private Sub cmdOkay_Click()

'Open the Specified Report Applying Filter if Required.
DoCmd.OpenReport Me.cmbReport.Value, acViewPreview, &quot;&quot;, &quot;&quot;
End Sub

Don't know this function, but you should be looking to see if it accepts optional arguments, if not find out what a safe dummy clause would be

;P
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top