Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-Filter or remove filter from a form once opened

Status
Not open for further replies.

ksgirl2

Programmer
Jul 19, 2002
45
0
0
US
Hello,

On two of my forms i have them filtered to open to a certain person's information. On the form there is a drop box of all the people in the database. I want to be able to have the form open to my filtered name and then if i desire to look at someone else's record on the form i would select that record (via selecting their name) from the drop down menu and have the form refresh to The NEW person's information. If i put a requery on the combo box for name it doesn't work due to the fact that the form is still filtering based on the original filter when it was opened from another seperate form.

Maybe this issue can be resolved by having a box at the top where you would type in the name and the record would appear. How would I go about fixing this?

Thanks in advance!
Marie
 
Try this:

In the afterupdate event of the combobox put the following code


Me.Filter = ""
Me.Filter = Put criteria here
Me.FilterOn = True
 
Oh I think that will work. Sorry but what would my criteria be?
me.filter = ????

Sorry I'm really new to this!
Thanks for your help!
marie
 
something like

"fieldname = " & me.combobox

if the value in the combobox is a string and not a number then



"fieldname = '" & me.combobox & "'"

 
Well The combo box gives me no error and yes the value is a number. it's a medical record number. But the rest of the information on the form is not refreshing. Requery doesn't work.
AHH! Please help. What do you need to know to help me.
Thanks
m
 
Make a command button, property OnClick: DoCmd.ShowAllRecords Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Ok. Showing all records doesn't work. I checked after i try selecting a different person and in the filter line of the form is still the OLD person's number. The error i get when trying to change the person is this...
"Function is not available in expressions in table-level validation expression."

I have NO CLUE what this means! Thanks for your help :)
M
 
Are you filtering at the form level or at the query level?
 
I'm filtering i think from the form level.. Should i try using the query level instead?

i'll give it a try and report back!
thanks
m
 
I played around with this a little more. Try this:


Me.FilterOn = False
Me.Filter = "id = " & Me.combobox
Me.FilterOn = True
 
Well i've ditched the filter idea and went for a query that querys the information from the changes in the combo box for MRnumber. I hope this works.

I still don't have this working smoothly.
thanks for all your help though!

marie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top