Need help

D

Dulce Candy

I cannot figure what is wrong with my code.. I am using the code from
template "Issues Tracker" to be able to search and filter and I keep getting
this debug error. The error highlights
"Me.Browse_All_Summaries_2008.Form.Filter = strWhere" in the code below. And
when I mouse over "Me.Browse_All_Summaries_2008.Form.FilterOn = True" it
indicates "False"

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Summaries 2008", 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_All_Summaries_2008.Form.Filter = strWhere
Me.Browse_All_Summaries_2008.Form.FilterOn = True
End If
End Sub

Any help is appreciated! Thanks!
 
D

Dulce Candy

Thanks for responded Gina,

Here is the entire code segment:

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 Associate
If Not IsNull(Me.Associate) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Associate] = " &
Me.Associate & ""
End If

' If Supervisor
If Not IsNull(Me.Super) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Super] = " &
Me.Super & ""
End If

' If Site
If Nz(Me.Site) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Site] = '" &
Me.Site & "'"
End If

' If Deficiency
If Nz(Me.Desc) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Desc] = '" &
Me.Desc & "'"
End If

' If Start Month
If IsDate(Me.StartMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] >= " &
GetDateFilter(Me.StartMonth)
ElseIf Nz(Me.StartMonth) <> "" Then
strError = cInvalidDateError
End If

' If End Month
If IsDate(Me.EndMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] <= " &
GetDateFilter(Me.EndMonth)
ElseIf Nz(Me.EndMonth) <> "" Then
strError = cInvalidDateError
End If


If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Summaries 2008", 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_All_Summaries_2008.Form.Filter = strWhere
Me.Browse_All_Summaries_2008.Form.FilterOn = True
End If
End Sub
 
G

Gina Whipp

Dulce,

I assuming by your code that Browse_All_Summaries_2008 is the form you are
on? If yes, change your code to the following...
Me.Filter = strWhere
Me.FilterOn = True

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Dulce "Candy" said:
Thanks for responded Gina,

Here is the entire code segment:

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 Associate
If Not IsNull(Me.Associate) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Associate] = " &
Me.Associate & ""
End If

' If Supervisor
If Not IsNull(Me.Super) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Super] = " &
Me.Super & ""
End If

' If Site
If Nz(Me.Site) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Site] = '" &
Me.Site & "'"
End If

' If Deficiency
If Nz(Me.Desc) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Desc] = '" &
Me.Desc & "'"
End If

' If Start Month
If IsDate(Me.StartMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] >= " &
GetDateFilter(Me.StartMonth)
ElseIf Nz(Me.StartMonth) <> "" Then
strError = cInvalidDateError
End If

' If End Month
If IsDate(Me.EndMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] <= " &
GetDateFilter(Me.EndMonth)
ElseIf Nz(Me.EndMonth) <> "" Then
strError = cInvalidDateError
End If


If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Summaries 2008", 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_All_Summaries_2008.Form.Filter = strWhere
Me.Browse_All_Summaries_2008.Form.FilterOn = True
End If
End Sub
Gina Whipp said:
Dulce,

Umm, where is the strWhere? You are telling it to Filter on strWhere but
I
don't see where you define it? Perhaps posting the entire code segment
will
help.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
G

Gina Whipp

I should also note that Month is a reserved word and you probably want to
fix that. For a complete list of Reserved Words see
http://allenbrowne.com/AppIssueBadWord.html

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Dulce "Candy" said:
Thanks for responded Gina,

Here is the entire code segment:

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 Associate
If Not IsNull(Me.Associate) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Associate] = " &
Me.Associate & ""
End If

' If Supervisor
If Not IsNull(Me.Super) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Super] = " &
Me.Super & ""
End If

' If Site
If Nz(Me.Site) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Site] = '" &
Me.Site & "'"
End If

' If Deficiency
If Nz(Me.Desc) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Desc] = '" &
Me.Desc & "'"
End If

' If Start Month
If IsDate(Me.StartMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] >= " &
GetDateFilter(Me.StartMonth)
ElseIf Nz(Me.StartMonth) <> "" Then
strError = cInvalidDateError
End If

' If End Month
If IsDate(Me.EndMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] <= " &
GetDateFilter(Me.EndMonth)
ElseIf Nz(Me.EndMonth) <> "" Then
strError = cInvalidDateError
End If


If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Summaries 2008", 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_All_Summaries_2008.Form.Filter = strWhere
Me.Browse_All_Summaries_2008.Form.FilterOn = True
End If
End Sub
Gina Whipp said:
Dulce,

Umm, where is the strWhere? You are telling it to Filter on strWhere but
I
don't see where you define it? Perhaps posting the entire code segment
will
help.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
D

Dulce Candy

Here is a little more background:

The form that I am on is "Search Associates Deficiencies". It is supposed
to let me search by associate/Site/Supervisor/Deficiency/specified time frame
and filter it to a subform datasheet. When I select a name in the form and
click on search it gives me this error and all the unfiltered records appear
in subform area:

Run-time error '2448:

You can't assign a value to this object

and it gives me the option to END or DEBUG.

When I click DEBUG it goes to Visual basic and highlights the areas I
mentioned in previous message.

Thanks again for your help :eek:)

Gina Whipp said:
Dulce,

I assuming by your code that Browse_All_Summaries_2008 is the form you are
on? If yes, change your code to the following...
Me.Filter = strWhere
Me.FilterOn = True

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Dulce "Candy" said:
Thanks for responded Gina,

Here is the entire code segment:

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 Associate
If Not IsNull(Me.Associate) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Associate] = " &
Me.Associate & ""
End If

' If Supervisor
If Not IsNull(Me.Super) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Super] = " &
Me.Super & ""
End If

' If Site
If Nz(Me.Site) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Site] = '" &
Me.Site & "'"
End If

' If Deficiency
If Nz(Me.Desc) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Desc] = '" &
Me.Desc & "'"
End If

' If Start Month
If IsDate(Me.StartMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] >= " &
GetDateFilter(Me.StartMonth)
ElseIf Nz(Me.StartMonth) <> "" Then
strError = cInvalidDateError
End If

' If End Month
If IsDate(Me.EndMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] <= " &
GetDateFilter(Me.EndMonth)
ElseIf Nz(Me.EndMonth) <> "" Then
strError = cInvalidDateError
End If


If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Summaries 2008", 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_All_Summaries_2008.Form.Filter = strWhere
Me.Browse_All_Summaries_2008.Form.FilterOn = True
End If
End Sub
Gina Whipp said:
Dulce,

Umm, where is the strWhere? You are telling it to Filter on strWhere but
I
don't see where you define it? Perhaps posting the entire code segment
will
help.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

I cannot figure what is wrong with my code.. I am using the code from
template "Issues Tracker" to be able to search and filter and I keep
getting
this debug error. The error highlights
"Me.Browse_All_Summaries_2008.Form.Filter = strWhere" in the code
below.
And
when I mouse over "Me.Browse_All_Summaries_2008.Form.FilterOn = True"
it
indicates "False"

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Summaries 2008", 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_All_Summaries_2008.Form.Filter = strWhere
Me.Browse_All_Summaries_2008.Form.FilterOn = True
End If
End Sub

Any help is appreciated! Thanks!
 
G

Gina Whipp

Okay, now I am really confused... could be just me but here it goes...

You are on Search Associates Deficiences (Main Form). You click 'Search'
which is a command button. Based on the selections you made on Search
Associates Deficiences (Main Form) you want to open Summaries 2008.

Here's where my confusion sets in... What is Browse_All_Summaries_2008 and
why are you trying to pass a filter to it? Also the line that opens
Summaries 2008 is remmed out, which means it won't work. OR is
Browse_All_Summaries_2008 as subform of Search Associates Deficiences (Main
Form)?

Also, it should be noted some functions won't work on a datasheet, you might
trying switching to form view and seeing what happens.

Now if all you are trying to do is limit the records why not Link
(Master)MainForm/(Child)Subform to the controls?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Dulce "Candy" said:
Here is a little more background:

The form that I am on is "Search Associates Deficiencies". It is supposed
to let me search by associate/Site/Supervisor/Deficiency/specified time
frame
and filter it to a subform datasheet. When I select a name in the form
and
click on search it gives me this error and all the unfiltered records
appear
in subform area:

Run-time error '2448:

You can't assign a value to this object

and it gives me the option to END or DEBUG.

When I click DEBUG it goes to Visual basic and highlights the areas I
mentioned in previous message.

Thanks again for your help :eek:)

Gina Whipp said:
Dulce,

I assuming by your code that Browse_All_Summaries_2008 is the form you
are
on? If yes, change your code to the following...
Me.Filter = strWhere
Me.FilterOn = True

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Dulce "Candy" said:
Thanks for responded Gina,

Here is the entire code segment:

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 Associate
If Not IsNull(Me.Associate) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Associate] = "
&
Me.Associate & ""
End If

' If Supervisor
If Not IsNull(Me.Super) Then
'Add the predicate
strWhere = strWhere & " AND " & "Summaries 2008.[Super] = " &
Me.Super & ""
End If

' If Site
If Nz(Me.Site) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Site] = '" &
Me.Site & "'"
End If

' If Deficiency
If Nz(Me.Desc) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "Summaries 2008.[Desc] = '" &
Me.Desc & "'"
End If

' If Start Month
If IsDate(Me.StartMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] >= " &
GetDateFilter(Me.StartMonth)
ElseIf Nz(Me.StartMonth) <> "" Then
strError = cInvalidDateError
End If

' If End Month
If IsDate(Me.EndMonth) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "Summaries 2008.[Month] <= " &
GetDateFilter(Me.EndMonth)
ElseIf Nz(Me.EndMonth) <> "" Then
strError = cInvalidDateError
End If


If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Summaries 2008", 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_All_Summaries_2008.Form.Filter = strWhere
Me.Browse_All_Summaries_2008.Form.FilterOn = True
End If
End Sub
:

Dulce,

Umm, where is the strWhere? You are telling it to Filter on strWhere
but
I
don't see where you define it? Perhaps posting the entire code
segment
will
help.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

message
I cannot figure what is wrong with my code.. I am using the code from
template "Issues Tracker" to be able to search and filter and I
keep
getting
this debug error. The error highlights
"Me.Browse_All_Summaries_2008.Form.Filter = strWhere" in the code
below.
And
when I mouse over "Me.Browse_All_Summaries_2008.Form.FilterOn =
True"
it
indicates "False"

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Summaries 2008", 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_All_Summaries_2008.Form.Filter = strWhere
Me.Browse_All_Summaries_2008.Form.FilterOn = True
End If
End Sub

Any help is appreciated! Thanks!
 

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