Filter a Continuous Form using a Drop-Down Box

  • Thread starter cw via AccessMonster.com
  • Start date
C

cw via AccessMonster.com

I have tried everything in the forums but cannot get my Continuous Form to
filter?
I have placed a simple Unbound Combo in the Header, with values "01" or "02"
but getting error: 2465 ?

If I use Access 2007 built-in Filtering, by right-clicking the Cycle field in
one of the records, and choose "Equal "01", the displayed records filter
correctly and display only the "01" records.

Thanks,
cw

-------------------------------------------------------
Private Sub ComboCycle_AfterUpdate()

Select Case Me!ComboCycle
Case Is = "01"
Me.Filter = ([qryAccounts_with_Balance_Due].[cycle] = "01")
Me.FilterOn = True
'MsgBox "Display Cycle 01 Records Only"
Case Is = "02"
Me.Filter = ([qryAccounts_with_Balance_Due].[cycle] = "02")
Me.FilterOn = True
'MsgBox "Display Cycle 02 Records Only"

End Select
End Sub
 
D

Douglas J. Steele

Error 2465 indicates that Access can't find the field.

Try leaving off the [qryAccounts_with_Balance_Due] when setting the filter.
If that doesn't work, make sure that the field name really is Cycle.
 
G

Gina Whipp

CW,

In additon to what Douglas said... If the field really is named "Cycle"
going to suggest you change that as it is a Reserved Word. For a complete
list see: http://allenbrowne.com/AppIssueBadWord.html#C

--
Gina Whipp

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

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

Douglas J. Steele said:
Error 2465 indicates that Access can't find the field.

Try leaving off the [qryAccounts_with_Balance_Due] when setting the
filter. If that doesn't work, make sure that the field name really is
Cycle.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


cw via AccessMonster.com said:
I have tried everything in the forums but cannot get my Continuous Form to
filter?
I have placed a simple Unbound Combo in the Header, with values "01" or
"02"
but getting error: 2465 ?

If I use Access 2007 built-in Filtering, by right-clicking the Cycle
field in
one of the records, and choose "Equal "01", the displayed records filter
correctly and display only the "01" records.

Thanks,
cw

-------------------------------------------------------
Private Sub ComboCycle_AfterUpdate()

Select Case Me!ComboCycle
Case Is = "01"
Me.Filter = ([qryAccounts_with_Balance_Due].[cycle] = "01")
Me.FilterOn = True
'MsgBox "Display Cycle 01 Records Only"
Case Is = "02"
Me.Filter = ([qryAccounts_with_Balance_Due].[cycle] = "02")
Me.FilterOn = True
'MsgBox "Display Cycle 02 Records Only"

End Select
End Sub
 
J

jalexander via AccessMonster.com

Thanks for the input..

- I changed the name to Cyc, still get the Error: 2465

- I tried: Me.Filter = (frmRedLetter![qryAccounts_with_Balance_Due].[Cyc] =
"02") , get Error: 424 (Object Required)

- I tried: Me.Filter = "Cyc =" & "01" , get Error: 3709 (Search key was not
found in any record)



Gina said:
CW,

In additon to what Douglas said... If the field really is named "Cycle"
going to suggest you change that as it is a Reserved Word. For a complete
list see: http://allenbrowne.com/AppIssueBadWord.html#C
Error 2465 indicates that Access can't find the field.
[quoted text clipped - 32 lines]
 
G

Gina Whipp

jalexander,

If Cyc is the name of the field no quotes required...

Me.Filter = Me.Cyc = "01"

The way you have it it is trying to find Cyc=01 IN the field.

--
Gina Whipp

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

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

jalexander via AccessMonster.com said:
Thanks for the input..

- I changed the name to Cyc, still get the Error: 2465

- I tried: Me.Filter = (frmRedLetter![qryAccounts_with_Balance_Due].[Cyc]
=
"02") , get Error: 424 (Object Required)

- I tried: Me.Filter = "Cyc =" & "01" , get Error: 3709 (Search key was
not
found in any record)



Gina said:
CW,

In additon to what Douglas said... If the field really is named "Cycle"
going to suggest you change that as it is a Reserved Word. For a complete
list see: http://allenbrowne.com/AppIssueBadWord.html#C
Error 2465 indicates that Access can't find the field.
[quoted text clipped - 32 lines]
End Sub
-------------------------------------------------------
 
C

cw via AccessMonster.com

Thanks Gina,
- I changed it to: Me.Filter = Me.Cyc = "01" (get no error's, but the records
do not get filtered?)

- When I try the second option for: Me.Filter = Me.Cyc = "02", I get error:94
(Invalid Use of Null)

I also recreated a new Drop-down box, using Value List: 1;"Cycle 01";2;"Cycle
02"

Private Sub Combo153_AfterUpdate()
Select Case Me.Combo153
Case Is = 1
Me.Filter = Me.Cyc = "01" (This option displays zero records?)
Me.FilterOn = True
'MsgBox "Display Cycle 01 Records Only"
Case Is = 2
Me.Filter = Me.Cyc = "02" (This option displays error:94 (Invalid
Use of Null)?)
Me.FilterOn = True
'MsgBox "Display Cycle 02 Records Only"

End Select
End Sub

Gina said:
jalexander,

If Cyc is the name of the field no quotes required...

Me.Filter = Me.Cyc = "01"

The way you have it it is trying to find Cyc=01 IN the field.
Thanks for the input..
[quoted text clipped - 19 lines]
 
M

Marshall Barton

cw said:
I have tried everything in the forums but cannot get my Continuous Form to
filter?
I have placed a simple Unbound Combo in the Header, with values "01" or "02"
but getting error: 2465 ?

If I use Access 2007 built-in Filtering, by right-clicking the Cycle field in
one of the records, and choose "Equal "01", the displayed records filter
correctly and display only the "01" records.

-------------------------------------------------------
Private Sub ComboCycle_AfterUpdate()

Select Case Me!ComboCycle
Case Is = "01"
Me.Filter = ([qryAccounts_with_Balance_Due].[cycle] = "01")
Me.FilterOn = True
'MsgBox "Display Cycle 01 Records Only"
Case Is = "02"
Me.Filter = ([qryAccounts_with_Balance_Due].[cycle] = "02")
Me.FilterOn = True
'MsgBox "Display Cycle 02 Records Only"

End Select
End Sub
-------------------------------------------------------


The Filter property is a string so the condition must be a
string, not a true/false value. Try writing it this way:

Me.Filter = "cycle = '01' "

If the combo box can only have the two values, y
you can combine the conditions and get rid of the Select
Case

Private Sub ComboCycle_AfterUpdate()
Me.Filter = "cycle = '" & Me.ComboCycle & "' "
Me.FilterOn = True
End Sub
 
C

cw via AccessMonster.com

- This is now filtering properly: Me.Filter = "Cyc = '01' "

- Lastly, how do I make the unbound 01 or 02 values stay visible in the drop-
down box?

Thanks to all..
Especially thanks to Marshall..



Marshall said:
I have tried everything in the forums but cannot get my Continuous Form to
filter?
[quoted text clipped - 21 lines]
End Sub
-------------------------------------------------------

The Filter property is a string so the condition must be a
string, not a true/false value. Try writing it this way:

Me.Filter = "cycle = '01' "

If the combo box can only have the two values, y
you can combine the conditions and get rid of the Select
Case

Private Sub ComboCycle_AfterUpdate()
Me.Filter = "cycle = '" & Me.ComboCycle & "' "
Me.FilterOn = True
End Sub
 
M

Marshall Barton

cw said:
- Lastly, how do I make the unbound 01 or 02 values stay visible in the drop-
down box?

Normally, that's not an issue so I can't tell without
knowing the details of how you set the combo box properties
to prevent display of the selected value.
 

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