A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

The ServerFilter of my subform is save when the form close.



 
 
Thread Tools Display Modes
  #1  
Old January 28th, 2010, 07:43 PM posted to microsoft.public.access.forms
TazQuebec
external usenet poster
 
Posts: 1
Default The ServerFilter of my subform is save when the form close.

I want the informations shown in a subform to change when the value of a Drop
Down Field. I use the property serverfilter of my subform.

It works if there was no value beforehand in the property.

Otherwise Access does not take in account the new criteria.

I use Access 2003 with SQL Server 2005. The form use a view

http://www.tazquebec.com/programmation/frmModele.jpg

Thanks to the advance of your help and here is my code:

Private Sub drpdwn_Section_Q_Change()
Select Case drpdwn_Section_Q.Column(2)
Case "S"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Avant_Étiquette").
Caption = "NB Suite"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_H rs_Avant_Étiquette").
Caption = "Hrs Suite"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Apres_Étiquette").
Caption = "NB Nouveau"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_H rs_Apres_Étiquette").
Caption = "Hrs Nouveau"
Case "A"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Avant_Étiquette").
Caption = "NB Année 1"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_H rs_Avant_Étiquette").
Caption = "Hrs Année 1"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Apres_Étiquette").
Caption = "NB Année 2"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_H rs_Apres_Étiquette").
Caption = "Hrs Année 2"
Case Else
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Avant_Étiquette").
Caption = "Hrs ?"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Apres_Étiquette").
Caption = "Hrs ?"
End Select
Me.frmMD_with_Desc_of_Activite.Form.ServerFilter = "ref_Modele = " &
drpdwn_Modeles.Value & " AND ref_Phase = " & drpdwn_Phase.Value & " AND
ref_SA = " & drpdwn_Section_Q.Value
Me.frmMD_with_Desc_of_Activite.Form.Requery
Me.frmMD_with_Desc_of_Activite.Form.Repaint
End Sub

  #2  
Old January 29th, 2010, 02:33 PM posted to microsoft.public.access.forms
TazQuebec via AccessMonster.com
external usenet poster
 
Posts: 2
Default The ServerFilter of my subform is save when the form close.

On my way to work I had a flash.

I solve my problem by emptying the ServerFilter after the Requery. So when
the form is close the ServerFilter propriety is save with a empty value.
Yesterday I try that on the close of the form but it did not work.

Me.frmMD_with_Desc_of_Activite.Form.ServerFilter = "ref_Modele = " &
drpdwn_Modeles.Value & " AND ref_Phase = " & drpdwn_Phase.Value & " AND
ref_SA = " & drpdwn_Section_Q.Value
Me.frmMD_with_Desc_of_Activite.Form.Requery
Me.frmMD_with_Desc_of_Activite.Form.ServerFilter = ""
Me.frmMD_with_Desc_of_Activite.Form.Repaint

Thanks you for your time all and I hope my solution may help someone else.


TazQuebec wrote:
I want the informations shown in a subform to change when the value of a Drop
Down Field. I use the property serverfilter of my subform.

It works if there was no value beforehand in the property.

Otherwise Access does not take in account the new criteria.

I use Access 2003 with SQL Server 2005. The form use a view

http://www.tazquebec.com/programmation/frmModele.jpg

Thanks to the advance of your help and here is my code:

Private Sub drpdwn_Section_Q_Change()
Select Case drpdwn_Section_Q.Column(2)
Case "S"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Val e ur_Avant_Étiquette").
Caption = "NB Suite"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_ H rs_Avant_Étiquette").
Caption = "Hrs Suite"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Val e ur_Apres_Étiquette").
Caption = "NB Nouveau"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_ H rs_Apres_Étiquette").
Caption = "Hrs Nouveau"
Case "A"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Val e ur_Avant_Étiquette").
Caption = "NB Année 1"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_ H rs_Avant_Étiquette").
Caption = "Hrs Année 1"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Val e ur_Apres_Étiquette").
Caption = "NB Année 2"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_ H rs_Apres_Étiquette").
Caption = "Hrs Année 2"
Case Else
Me.frmMD_with_Desc_of_Activite.Form.Controls("Val e ur_Avant_Étiquette").
Caption = "Hrs ?"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Val e ur_Apres_Étiquette").
Caption = "Hrs ?"
End Select
Me.frmMD_with_Desc_of_Activite.Form.ServerFilte r = "ref_Modele = " &
drpdwn_Modeles.Value & " AND ref_Phase = " & drpdwn_Phase.Value & " AND
ref_SA = " & drpdwn_Section_Q.Value
Me.frmMD_with_Desc_of_Activite.Form.Requery
Me.frmMD_with_Desc_of_Activite.Form.Repaint
End Sub


--
Message posted via http://www.accessmonster.com

  #3  
Old January 29th, 2010, 03:09 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default The ServerFilter of my subform is save when the form close.

TazQuebec -

You need to turn the filter on, not just set the filter. Also, I suspect
you may be missing some delimeters in your filter. I have added single
quotes around the drpdwn_Phase.Value in your statement below, assuming that
was text, but you may need to change if it is numeric, and if any of the
other values are strings.

Me.frmMD_with_Desc_of_Activite.Form.ServerFilter = "ref_Modele = " &
drpdwn_Modeles.Value & " AND ref_Phase = '" & drpdwn_Phase.Value & "' AND
ref_SA = " & drpdwn_Section_Q.Value

Me.frmMD_with_Desc_of_Activite.Form.ServerFilterBy Form = True

I assume you are compiling your code. If this doesn't fix your problem, let
us know what the problem is - any error messages? Have you stepped through
the code in debug mode to make sure it is executing?

--
Daryl S


"TazQuebec" wrote:

I want the informations shown in a subform to change when the value of a Drop
Down Field. I use the property serverfilter of my subform.

It works if there was no value beforehand in the property.

Otherwise Access does not take in account the new criteria.

I use Access 2003 with SQL Server 2005. The form use a view

http://www.tazquebec.com/programmation/frmModele.jpg

Thanks to the advance of your help and here is my code:

Private Sub drpdwn_Section_Q_Change()
Select Case drpdwn_Section_Q.Column(2)
Case "S"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Avant_Étiquette").
Caption = "NB Suite"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_H rs_Avant_Étiquette").
Caption = "Hrs Suite"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Apres_Étiquette").
Caption = "NB Nouveau"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_H rs_Apres_Étiquette").
Caption = "Hrs Nouveau"
Case "A"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Avant_Étiquette").
Caption = "NB Année 1"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_H rs_Avant_Étiquette").
Caption = "Hrs Année 1"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Apres_Étiquette").
Caption = "NB Année 2"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Nb_H rs_Apres_Étiquette").
Caption = "Hrs Année 2"
Case Else
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Avant_Étiquette").
Caption = "Hrs ?"
Me.frmMD_with_Desc_of_Activite.Form.Controls("Vale ur_Apres_Étiquette").
Caption = "Hrs ?"
End Select
Me.frmMD_with_Desc_of_Activite.Form.ServerFilter = "ref_Modele = " &
drpdwn_Modeles.Value & " AND ref_Phase = " & drpdwn_Phase.Value & " AND
ref_SA = " & drpdwn_Section_Q.Value
Me.frmMD_with_Desc_of_Activite.Form.Requery
Me.frmMD_with_Desc_of_Activite.Form.Repaint
End Sub

.

  #4  
Old February 2nd, 2010, 08:05 PM posted to microsoft.public.access.forms
TazQuebec via AccessMonster.com
external usenet poster
 
Posts: 2
Default The ServerFilter of my subform is save when the form close.

I have tried that.

It did not work the Serverfilter is save on the close of the form.

The next time the form is use it ignore the new filter value and use the save
one.

Setting the ServerFilterByForm to true has no effect.

My solution was to set the Serverfilter to empty after the requery.

Thanks


Daryl S wrote:
TazQuebec -

You need to turn the filter on, not just set the filter. Also, I suspect
you may be missing some delimeters in your filter. I have added single
quotes around the drpdwn_Phase.Value in your statement below, assuming that
was text, but you may need to change if it is numeric, and if any of the
other values are strings.

Me.frmMD_with_Desc_of_Activite.Form.ServerFilte r = "ref_Modele = " &
drpdwn_Modeles.Value & " AND ref_Phase = '" & drpdwn_Phase.Value & "' AND
ref_SA = " & drpdwn_Section_Q.Value

Me.frmMD_with_Desc_of_Activite.Form.ServerFilterB yForm = True

I assume you are compiling your code. If this doesn't fix your problem, let
us know what the problem is - any error messages? Have you stepped through
the code in debug mode to make sure it is executing?

I want the informations shown in a subform to change when the value of a Drop
Down Field. I use the property serverfilter of my subform.

[quoted text clipped - 43 lines]

.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201002/1

 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.