dbTalk Databases Forums  

update subform filter by onchange event on main form

comp.databases.ms-access comp.databases.ms-access


Discuss update subform filter by onchange event on main form in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
maciejfr@poczta.onet.pl
 
Posts: n/a

Default update subform filter by onchange event on main form - 02-28-2008 , 02:17 AM






Hello everyone,

My problem is updating Subform filter by onchange event in one of
main form field

I've got following:

Me![NOTAWY Podformularz].Form.Filter = "[zamkniecie] = "" N ""
OR ([zamkniecie] = ""T"" AND notanr = " & Me!nrnoty & ")"
Forms!frmNOTAWY.Form![NOTAWY Podformularz].Requery


Is Change right event for that?

Thank you in advance!

Maciej

Reply With Quote
  #2  
Old   
Dominic Vella
 
Posts: n/a

Default Re: update subform filter by onchange event on main form - 02-28-2008 , 07:36 AM






Hi Macie

OnChange may not be best as it triggers off too regularly. It's probably
best using the BeforeUpdate Event.

Dom

<maciejfr (AT) poczta (DOT) onet.pl> wrote

Quote:
Hello everyone,

My problem is updating Subform filter by onchange event in one of
main form field

I've got following:

Me![NOTAWY Podformularz].Form.Filter = "[zamkniecie] = "" N ""
OR ([zamkniecie] = ""T"" AND notanr = " & Me!nrnoty & ")"
Forms!frmNOTAWY.Form![NOTAWY Podformularz].Requery


Is Change right event for that?

Thank you in advance!

Maciej



Reply With Quote
  #3  
Old   
Salad
 
Posts: n/a

Default Re: update subform filter by onchange event on main form - 02-28-2008 , 11:07 AM



Dominic Vella wrote:

Quote:
Hi Macie

OnChange may not be best as it triggers off too regularly. It's probably
best using the BeforeUpdate Event.
I suppose OnChange would be useful if the developer desired the form be
filtered everytime a key is pressed. Personally, I prefer the
AfterUpdate event because the BeforeUpdate event may have error
validation checks and could be canceled.

I really don't see why Macie needs to requery the form when a new filter
is applied. Making a new filter should be sufficient. If the filteron
property in on, the form will be requeried 2 times. The code I usually
use to filter looks something like this
Dim strF as String
If Not Isnull(Me.Status) then
strF = "Status = '" & Me.Status & "'"
Endif
Me.Filter = strF
Me.FilterOn = (strF > "")

Carolina
http://www.youtube.com/watch?v=wxMHn5oYJq4

Quote:
Dom

maciejfr (AT) poczta (DOT) onet.pl> wrote in message
news:f7d47396-1e35-4f99-8e14-eb9d137cb805 (AT) c33g2000hsd (DOT) googlegroups.com...

Hello everyone,

My problem is updating Subform filter by onchange event in one of
main form field

I've got following:

Me![NOTAWY Podformularz].Form.Filter = "[zamkniecie] = "" N ""
OR ([zamkniecie] = ""T"" AND notanr = " & Me!nrnoty & ")"
Forms!frmNOTAWY.Form![NOTAWY Podformularz].Requery


Is Change right event for that?

Thank you in advance!

Maciej




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.