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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Filter in a Form

Status
Not open for further replies.

LittleNick

Technical User
Jun 26, 2009
55
US
Hi Everyone,

I have a Main Customer form with a button when I click it, it will open another form, with code something like this when button is clicked:

stDocName = "frmCustomerBillingInfo"
stLinkCriteria = "[CustomerID] = " & Me![ID]

DoCmd.OpenForm stDocName, , , stLinkCriteria

It works well most of the time, but once in while, when a user click the button, the CustomerBilling form would alway display the same Customer billing info. To fix the problem I have to go to the form's design view and clear the Server Filter property (somehow, the criteria has been added into the server filter property). My question is how can I make the form so the server filter property would always be blank and nothing inserted by the system.
Thanks for your helps.
 
What do you mean "Server" filter property? What version of Access?

As far as I know form's have a filter property that basically recieves the criteria argument from docmd.openform. That should overwrite the filter when it opens. Or is the problem that the form is not always opened from that button? In that case the issue is someone is saving the form which saves the filter with it. I would probably just set the filter to a zero length string on close to prevent this (assuming they are saying yes to save changes to frm...).
 
You could try this instead of your current method as well... or else add some of this to it..

Code:
Form.Filter = vbNullString
Form.FilterOn = False
Form.Filter = stLinkCriteria 
Form.FilterOn = True

The first 2 lines may not be required, but I'm just wondering if clearing the filter first will help make sure you don't wind up with the same as your current delimna. Also, you may not need to re-open the form this way each time, so it may end up being a little faster. But this is just a thought at this point, I've not tested it.. and which method is faster may depend upon what else is on your form.

"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
 
Oh.. and the reason why it's being put into the Filter property is becuase that's what you're setting.... if you look a the little help pop-ups for the portion where you're putting the strLinkCrtieria, when typing the values into the vba code, it'll tell you "form filter" or something like that..

"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top