filter problem

P

PayeDoc

Hello All

I have a form [frm staff new] that shows employee records in single form
view. The form has a combobox [Combo263] that can be used to select an
employee: the combobox's onclick event is:

Me.RecordsetClone.FindFirst "[name] = """ & Me![Combo263] & """"
Me.Bookmark = Me.RecordsetClone.Bookmark

(I know that [name] is a 'banned' field name, but I inherited this ... and
it works!)

Sometimes the user opens the form with a control that immediately filters
the form to show a particular record. When they do that, [Combo263] on [frm
staff new] doesn't work - it can't find the selected record (presumably
because it only has the single record previously filtered to search
through). So I thought I would add an OnGotFocus event to [Combo263] that
would revert to the normal filter that is in [frm staff new]'s OnLoad
event - this is:

Me.Filter = "[practice] = Forms![frm x main]![prac name] and
=false"

But now, when I try to use [Combo263] I get
Error 2465 - Microsoft Access can't find the field Forms referred to in your
expression
and clicking on Debug opens the VBA window with the following line
highlighted in yellow:
Me.Bookmark = Me.RecordsetClone.Bookmark

Can anyone help me get round this?
Thanks for any help
Leslie Isaacs​
 
A

AccessVandal via AccessMonster.com

Maybe the form is corrupted. Try the compile the code and do a compact and
repair. If the code really works, sometimes it's the the quirks of Access.

If it still doesn't work, you might want to recode in another method.
Hello All

I have a form [frm staff new] that shows employee records in single form
view. The form has a combobox [Combo263] that can be used to select an
employee: the combobox's onclick event is:

Me.RecordsetClone.FindFirst "[name] = """ & Me![Combo263] & """"
Me.Bookmark = Me.RecordsetClone.Bookmark

(I know that [name] is a 'banned' field name, but I inherited this ... and
it works!)

Sometimes the user opens the form with a control that immediately filters
the form to show a particular record. When they do that, [Combo263] on [frm
staff new] doesn't work - it can't find the selected record (presumably
because it only has the single record previously filtered to search
through). So I thought I would add an OnGotFocus event to [Combo263] that
would revert to the normal filter that is in [frm staff new]'s OnLoad
event - this is:

Me.Filter = "[practice] = Forms![frm x main]![prac name] and
=false"

But now, when I try to use [Combo263] I get
Error 2465 - Microsoft Access can't find the field Forms referred to in your
expression
and clicking on Debug opens the VBA window with the following line
highlighted in yellow:
Me.Bookmark = Me.RecordsetClone.Bookmark

Can anyone help me get round this?
Thanks for any help
Leslie Isaacs​
 

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