applying filter to a form

snoopy22

Registered User.
Local time
Today, 09:32
Joined
Oct 1, 2004
Messages
45
Hello everyone,

I've got a control tab with the folowing tabs:

1. subform name "personalInfo"
2. subform name "CompanylInfo"

i want the control tab to show the relevant records according to the filter

also, i got a form name "advanced search" where the user type the desire filter.
then he click a button which open up the form with the control tab

i wrote the folowing code at the on open event of the "personal Info"

Private Sub Form_Open(Cancel As Integer)
DoCmd.ApplyFilter , sfilter '----- sfilter is my filter
End Sub

when click the button the folowing massage appears(on the apply filter row):

what shall i do???
 

Attachments

  • untitled.JPG
    untitled.JPG
    14.4 KB · Views: 215
Are you putting this in the subform event or on the main form event?

kh
 
i put it in the main form("PersonalInfo") event
 
Hum... Wonder if you put it in the on open of the sub form would it work?

kh
 
Have you tried something like:

forms!frmMain!subfrmMain.form.filter = "myfld = '" & sfilter & "'"

???
kh
 
I found the problem

you were right, thr applyfilter does'nt recognize the sfilter, how can i change his type to be a global? or how can i get to it from another form?
suppose the "sfilter" is on "advancedSearch" on a procedure event results_click(a button that apply the search)
 
I would just store the filter value on the form where the filter is to be applyed and ref it from there.

Exp: When the Filter form pops up and the user enters the value, set the new text box equal to that value and use the new text box as the filter. Then disable it but let the user see it so they know what the current filter is.

???
kh
 

Users who are viewing this thread

Back
Top Bottom