The first thing I would try is get rid of the ".value". Then add some debug.print statements which should always be included when writing code. Regards,
Duane
On February 19, 2018, at 5:34 PM, "dbalorenzini@yahoo.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
Private Sub cmdSearch_Click()
Dim varWhere As Variant
' Initialize to Null
varWhere = Null
' Do Issue Subject next
If Not IsNothing(Me.txtIssueSubject) Then
' .. build the predicate
' Note: taking advantage of Null propogation
' so we don't have to test for any previous predicate
varWhere = (varWhere + " AND ") & "([IssueSubject] LIKE '" & Me.txtIssueSubject & "*')"
End If
' Do Issue Description next
If Not IsNothing(Me.txtIssueDesc) Then
' .. build the predicate
varWhere = (varWhere + " AND ") & "([IssueDescription] LIKE '" & Me.txtIssueDesc & "*')"
End If
If Not IsNothing(Me.cmbIssuer) Then
' .. build the predicate
varWhere = "(UserID.Value = " & Me.cmbIssuer & ")"
End If
' Check to see that we built a filter
If IsNothing(varWhere) Then
MsgBox "You must enter at least one search criteria.", vbInformation, gstrAppTitle
Exit Sub
End If
' See if any rows with a quick DLookup
If IsNothing(DLookup("ServiceRequestID", "tblSystemServiceRequest", varWhere)) Then
MsgBox "No Service Request meet your criteria.", vbInformation, gstrAppTitle
Exit Sub
End If
' Open Companies filtered
' Note: if form already open, this just applies the filter
DoCmd.OpenForm "frmSystem_ServiecRequest", WhereCondition:=varWhere
' Done
DoCmd.Close acForm, Me.Name
End Sub
Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar