run time error 3075

B

BenNeedHelp

I am very very new to writing visual basic code and I am trying to make my
search button work like the one in the sample Issues Database. There are
unbound text and combo boxes in the detail section of the form where the user
should be able to key in the data they want to search by. Clicking on the
search button should open a subform in the footer section of the form
displaying the records that fit the search criteria entered in the unbound
boxes. I am getting the following error message: Run-time error '3075':
syntax error(missing operator) in query expression '1+1 AND Mail Log.[Opened
by] Parker, John".

I don't know how to fix the problem. The code that I am using is below.
Any suggestions would be greatly appreciated.

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"

' If Date Received From
If IsDate(Me.DateReceivedFrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] >= " &
GetDateFilter(Me.DateReceivedFrom)
ElseIf Nz(Me.DateReceivedFrom) <> "" Then
strError = cInvalidDateError
End If

' If Date Received To
If IsDate(Me.DateReceivedTo) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] <= " &
GetDateFilter(Me.DateReceivedTo)
ElseIf Nz(Me.DateReceivedTo) <> "" Then
strError = cInvalidDateError
End If

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = " &
Me.Openedby & "'"
End If

' If Case Name
If Nz(Me.CaseName) <> "" Then
'Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "Mail Log.[Case Name] = " &
Me.CaseName & "'"
End If

' If Case Number
If Nz(Me.CaseNumber) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Case Number] = '" &
Me.CaseNumber & "'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse Mail", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse_Mail.Form.Filter = strWhere
Me.Browse_Mail.Form.FilterOn = True
End If
End Sub
 
D

Douglas J. Steele

When you're passing text values, you need to enclose them in quotes. While
you've got a closing quote afterwards, you're missing the opening quote:

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = '" &
Me.Openedby & "'"
End If

Exagerated for clarity, that's

strWhere = strWhere & " AND " & "Mail Log.[Opened by] = ' " & Me.Openedby
& " ' "

However, if there's a chance that the name can include an apostrophe
(O'Reilly), you either need to double up the apostrophe in the name:

strWhere = strWhere & " AND Mail Log.[Opened by] = '" &
Replace(Me.Openedby, "'", "''") & "'"

or use double quotes as a delimiter:

strWhere = strWhere & " AND Mail Log.[Opened by] = " & Chr$(34) &
Me.Openedby & Chr$(34)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


BenNeedHelp said:
I am very very new to writing visual basic code and I am trying to make my
search button work like the one in the sample Issues Database. There are
unbound text and combo boxes in the detail section of the form where the
user
should be able to key in the data they want to search by. Clicking on the
search button should open a subform in the footer section of the form
displaying the records that fit the search criteria entered in the unbound
boxes. I am getting the following error message: Run-time error '3075':
syntax error(missing operator) in query expression '1+1 AND Mail
Log.[Opened
by] Parker, John".

I don't know how to fix the problem. The code that I am using is below.
Any suggestions would be greatly appreciated.

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"

' If Date Received From
If IsDate(Me.DateReceivedFrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] >= " &
GetDateFilter(Me.DateReceivedFrom)
ElseIf Nz(Me.DateReceivedFrom) <> "" Then
strError = cInvalidDateError
End If

' If Date Received To
If IsDate(Me.DateReceivedTo) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] <= " &
GetDateFilter(Me.DateReceivedTo)
ElseIf Nz(Me.DateReceivedTo) <> "" Then
strError = cInvalidDateError
End If

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = " &
Me.Openedby & "'"
End If

' If Case Name
If Nz(Me.CaseName) <> "" Then
'Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "Mail Log.[Case Name] = " &
Me.CaseName & "'"
End If

' If Case Number
If Nz(Me.CaseNumber) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Case Number] = '" &
Me.CaseNumber & "'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse Mail", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse_Mail.Form.Filter = strWhere
Me.Browse_Mail.Form.FilterOn = True
End If
End Sub
 
B

BenNeedHelp

Thanks for your help Mr. Steele, I was able to get part of the code working
using the suggestions that you gave me. I am still having a little trouble.
I am able to filter by the date and Opened by fields only. I am unable to
filter by the Case Number and Name fields. Also the Browse subform is
supposed to open when the search button it is clicked, however, it is visible
when the main form is opened. I apologize for having seemingly simple
issues but I'm a novice when it comes to visual basic. Any suggestions to
correct my code would be greatly appreciated.

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"

' If Date Received From
If IsDate(Me.DateReceivedFrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail.[Date Received] >= " &
GetDateFilter(Me.DateReceivedFrom)
ElseIf Nz(Me.DateReceivedFrom) <> "" Then
strError = cInvalidDateError
End If

' If Date Received To
If IsDate(Me.DateReceivedTo) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail.[Date Received] <= " &
GetDateFilter(Me.DateReceivedTo)
ElseIf Nz(Me.DateReceivedTo) <> "" Then
strError = cInvalidDateError
End If

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail.[Opened by] = " & Chr$(34) &
Me.Openedby & Chr$(34)
End If

' If Name
If Nz(Me.Name) <> "" Then
'Add it to the predicate - Match on leading characters
strWhere = strWhere & " AND " & "Mail.Name Like '*" & Me.Name & "*'"
End If

' If Casenumber
If Nz(Me.CaseNumber) <> "" Then
'Add it to the predicate - Match on leading characters
strWhere = strWhere & " AND " & "Mail.CaseNumber Like '*" &
Me.CaseNumber & "*'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse", acFormDS,,strWhere,
acFormEdit,acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse.Form.Filter = strWhere
Me.Browse.Form.FilterOn = True
End If

End Sub


Douglas J. Steele said:
When you're passing text values, you need to enclose them in quotes. While
you've got a closing quote afterwards, you're missing the opening quote:

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = '" &
Me.Openedby & "'"
End If

Exagerated for clarity, that's

strWhere = strWhere & " AND " & "Mail Log.[Opened by] = ' " & Me.Openedby
& " ' "

However, if there's a chance that the name can include an apostrophe
(O'Reilly), you either need to double up the apostrophe in the name:

strWhere = strWhere & " AND Mail Log.[Opened by] = '" &
Replace(Me.Openedby, "'", "''") & "'"

or use double quotes as a delimiter:

strWhere = strWhere & " AND Mail Log.[Opened by] = " & Chr$(34) &
Me.Openedby & Chr$(34)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


BenNeedHelp said:
I am very very new to writing visual basic code and I am trying to make my
search button work like the one in the sample Issues Database. There are
unbound text and combo boxes in the detail section of the form where the
user
should be able to key in the data they want to search by. Clicking on the
search button should open a subform in the footer section of the form
displaying the records that fit the search criteria entered in the unbound
boxes. I am getting the following error message: Run-time error '3075':
syntax error(missing operator) in query expression '1+1 AND Mail
Log.[Opened
by] Parker, John".

I don't know how to fix the problem. The code that I am using is below.
Any suggestions would be greatly appreciated.

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"

' If Date Received From
If IsDate(Me.DateReceivedFrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] >= " &
GetDateFilter(Me.DateReceivedFrom)
ElseIf Nz(Me.DateReceivedFrom) <> "" Then
strError = cInvalidDateError
End If

' If Date Received To
If IsDate(Me.DateReceivedTo) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] <= " &
GetDateFilter(Me.DateReceivedTo)
ElseIf Nz(Me.DateReceivedTo) <> "" Then
strError = cInvalidDateError
End If

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = " &
Me.Openedby & "'"
End If

' If Case Name
If Nz(Me.CaseName) <> "" Then
'Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "Mail Log.[Case Name] = " &
Me.CaseName & "'"
End If

' If Case Number
If Nz(Me.CaseNumber) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Case Number] = '" &
Me.CaseNumber & "'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse Mail", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse_Mail.Form.Filter = strWhere
Me.Browse_Mail.Form.FilterOn = True
End If
End Sub
 
D

Douglas J Steele

Name is a reserved word. You shouldn't use it for a field of your own, nor
should you use it for a control on a form.

If you cannot change the field name, put square brackets around the word, as
in "Mail.[Name] Like '*"

If you cannot change the control name, use ! rather than .: Me!Name (Me.Name
returns the name of the form....)

As well, if you're possibly going to have names with apostrophes in them
(O'Reilly), you'd be better off using:

If Nz(Me.txtName) <> "" Then
'Add it to the predicate - Match on leading characters
strWhere = strWhere & " AND Mail.MailName Like " & Chr$(34) & "*" &
Me.Name & "*" & Chr$(34)
End If

Nothing obvious pops out regarding Case Number. What error do you get? Take
a look at what value's in strWhere: does it make sense? (I'm assuming that
CaseNumber is a text field in your table. Like only works with Text, not
numbers)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


BenNeedHelp said:
Thanks for your help Mr. Steele, I was able to get part of the code working
using the suggestions that you gave me. I am still having a little trouble.
I am able to filter by the date and Opened by fields only. I am unable to
filter by the Case Number and Name fields. Also the Browse subform is
supposed to open when the search button it is clicked, however, it is visible
when the main form is opened. I apologize for having seemingly simple
issues but I'm a novice when it comes to visual basic. Any suggestions to
correct my code would be greatly appreciated.

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"

' If Date Received From
If IsDate(Me.DateReceivedFrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail.[Date Received] >= " &
GetDateFilter(Me.DateReceivedFrom)
ElseIf Nz(Me.DateReceivedFrom) <> "" Then
strError = cInvalidDateError
End If

' If Date Received To
If IsDate(Me.DateReceivedTo) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail.[Date Received] <= " &
GetDateFilter(Me.DateReceivedTo)
ElseIf Nz(Me.DateReceivedTo) <> "" Then
strError = cInvalidDateError
End If

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail.[Opened by] = " & Chr$(34) &
Me.Openedby & Chr$(34)
End If

' If Name
If Nz(Me.Name) <> "" Then
'Add it to the predicate - Match on leading characters
strWhere = strWhere & " AND " & "Mail.Name Like '*" & Me.Name & "*'"
End If

' If Casenumber
If Nz(Me.CaseNumber) <> "" Then
'Add it to the predicate - Match on leading characters
strWhere = strWhere & " AND " & "Mail.CaseNumber Like '*" &
Me.CaseNumber & "*'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse", acFormDS,,strWhere,
acFormEdit,acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse.Form.Filter = strWhere
Me.Browse.Form.FilterOn = True
End If

End Sub


Douglas J. Steele said:
When you're passing text values, you need to enclose them in quotes. While
you've got a closing quote afterwards, you're missing the opening quote:

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = '" &
Me.Openedby & "'"
End If

Exagerated for clarity, that's

strWhere = strWhere & " AND " & "Mail Log.[Opened by] = ' " & Me.Openedby
& " ' "

However, if there's a chance that the name can include an apostrophe
(O'Reilly), you either need to double up the apostrophe in the name:

strWhere = strWhere & " AND Mail Log.[Opened by] = '" &
Replace(Me.Openedby, "'", "''") & "'"

or use double quotes as a delimiter:

strWhere = strWhere & " AND Mail Log.[Opened by] = " & Chr$(34) &
Me.Openedby & Chr$(34)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


BenNeedHelp said:
I am very very new to writing visual basic code and I am trying to make my
search button work like the one in the sample Issues Database. There are
unbound text and combo boxes in the detail section of the form where the
user
should be able to key in the data they want to search by. Clicking on the
search button should open a subform in the footer section of the form
displaying the records that fit the search criteria entered in the unbound
boxes. I am getting the following error message: Run-time error '3075':
syntax error(missing operator) in query expression '1+1 AND Mail
Log.[Opened
by] Parker, John".

I don't know how to fix the problem. The code that I am using is below.
Any suggestions would be greatly appreciated.

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"

' If Date Received From
If IsDate(Me.DateReceivedFrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] >= " &
GetDateFilter(Me.DateReceivedFrom)
ElseIf Nz(Me.DateReceivedFrom) <> "" Then
strError = cInvalidDateError
End If

' If Date Received To
If IsDate(Me.DateReceivedTo) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] <= " &
GetDateFilter(Me.DateReceivedTo)
ElseIf Nz(Me.DateReceivedTo) <> "" Then
strError = cInvalidDateError
End If

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = " &
Me.Openedby & "'"
End If

' If Case Name
If Nz(Me.CaseName) <> "" Then
'Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "Mail Log.[Case Name] = " &
Me.CaseName & "'"
End If

' If Case Number
If Nz(Me.CaseNumber) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Case Number] = '" &
Me.CaseNumber & "'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse Mail", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse_Mail.Form.Filter = strWhere
Me.Browse_Mail.Form.FilterOn = True
End If
End Sub
 
B

BenNeedHelp

Thanks so much for your help. Everything is working perfectly.

Douglas J Steele said:
Name is a reserved word. You shouldn't use it for a field of your own, nor
should you use it for a control on a form.

If you cannot change the field name, put square brackets around the word, as
in "Mail.[Name] Like '*"

If you cannot change the control name, use ! rather than .: Me!Name (Me.Name
returns the name of the form....)

As well, if you're possibly going to have names with apostrophes in them
(O'Reilly), you'd be better off using:

If Nz(Me.txtName) <> "" Then
'Add it to the predicate - Match on leading characters
strWhere = strWhere & " AND Mail.MailName Like " & Chr$(34) & "*" &
Me.Name & "*" & Chr$(34)
End If

Nothing obvious pops out regarding Case Number. What error do you get? Take
a look at what value's in strWhere: does it make sense? (I'm assuming that
CaseNumber is a text field in your table. Like only works with Text, not
numbers)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


BenNeedHelp said:
Thanks for your help Mr. Steele, I was able to get part of the code working
using the suggestions that you gave me. I am still having a little trouble.
I am able to filter by the date and Opened by fields only. I am unable to
filter by the Case Number and Name fields. Also the Browse subform is
supposed to open when the search button it is clicked, however, it is visible
when the main form is opened. I apologize for having seemingly simple
issues but I'm a novice when it comes to visual basic. Any suggestions to
correct my code would be greatly appreciated.

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"

' If Date Received From
If IsDate(Me.DateReceivedFrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail.[Date Received] >= " &
GetDateFilter(Me.DateReceivedFrom)
ElseIf Nz(Me.DateReceivedFrom) <> "" Then
strError = cInvalidDateError
End If

' If Date Received To
If IsDate(Me.DateReceivedTo) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail.[Date Received] <= " &
GetDateFilter(Me.DateReceivedTo)
ElseIf Nz(Me.DateReceivedTo) <> "" Then
strError = cInvalidDateError
End If

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail.[Opened by] = " & Chr$(34) &
Me.Openedby & Chr$(34)
End If

' If Name
If Nz(Me.Name) <> "" Then
'Add it to the predicate - Match on leading characters
strWhere = strWhere & " AND " & "Mail.Name Like '*" & Me.Name & "*'"
End If

' If Casenumber
If Nz(Me.CaseNumber) <> "" Then
'Add it to the predicate - Match on leading characters
strWhere = strWhere & " AND " & "Mail.CaseNumber Like '*" &
Me.CaseNumber & "*'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse", acFormDS,,strWhere,
acFormEdit,acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse.Form.Filter = strWhere
Me.Browse.Form.FilterOn = True
End If

End Sub


Douglas J. Steele said:
When you're passing text values, you need to enclose them in quotes. While
you've got a closing quote afterwards, you're missing the opening quote:

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = '" &
Me.Openedby & "'"
End If

Exagerated for clarity, that's

strWhere = strWhere & " AND " & "Mail Log.[Opened by] = ' " & Me.Openedby
& " ' "

However, if there's a chance that the name can include an apostrophe
(O'Reilly), you either need to double up the apostrophe in the name:

strWhere = strWhere & " AND Mail Log.[Opened by] = '" &
Replace(Me.Openedby, "'", "''") & "'"

or use double quotes as a delimiter:

strWhere = strWhere & " AND Mail Log.[Opened by] = " & Chr$(34) &
Me.Openedby & Chr$(34)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I am very very new to writing visual basic code and I am trying to make my
search button work like the one in the sample Issues Database. There are
unbound text and combo boxes in the detail section of the form where the
user
should be able to key in the data they want to search by. Clicking on the
search button should open a subform in the footer section of the form
displaying the records that fit the search criteria entered in the unbound
boxes. I am getting the following error message: Run-time error '3075':
syntax error(missing operator) in query expression '1+1 AND Mail
Log.[Opened
by] Parker, John".

I don't know how to fix the problem. The code that I am using is below.
Any suggestions would be greatly appreciated.

Private Sub Search_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String
strWhere = "1=1"

' If Date Received From
If IsDate(Me.DateReceivedFrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] >= " &
GetDateFilter(Me.DateReceivedFrom)
ElseIf Nz(Me.DateReceivedFrom) <> "" Then
strError = cInvalidDateError
End If

' If Date Received To
If IsDate(Me.DateReceivedTo) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Mail Log.[Date Received] <= " &
GetDateFilter(Me.DateReceivedTo)
ElseIf Nz(Me.DateReceivedTo) <> "" Then
strError = cInvalidDateError
End If

' If Opened by
If Nz(Me.Openedby) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Opened by] = " &
Me.Openedby & "'"
End If

' If Case Name
If Nz(Me.CaseName) <> "" Then
'Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "Mail Log.[Case Name] = " &
Me.CaseName & "'"
End If

' If Case Number
If Nz(Me.CaseNumber) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Mail Log.[Case Number] = '" &
Me.CaseNumber & "'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse Mail", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.Browse_Mail.Form.Filter = strWhere
Me.Browse_Mail.Form.FilterOn = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top