Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 01-28-2010, 06:43 AM
tazquebec tazquebec is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jan 2010
Posts: 6
tazquebec is on a distinguished road
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

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
Attached Images
File Type: jpg frmModele.jpg (145.3 KB, 0 views)

Last edited by tazquebec; 01-28-2010 at 07:22 AM. Reason: Add info
Reply With Quote
  #2  
Old 01-29-2010, 06:07 AM
tazquebec tazquebec is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jan 2010
Posts: 6
tazquebec is on a distinguished road
Smile 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 an empty value. Yesterday I try that on the close event 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.
Reply With Quote
  #3  
Old 01-29-2010, 08:33 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

Thanks for posting your solution.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
Reply

Bookmarks

Tags
access 2003, serverfilter, sql server 2005

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save and Go to another form - simple yes? durstlaw Forms 1 12-14-2009 09:46 PM
Close button of the form not appears, but is enabled bladu Forms 4 09-10-2009 01:09 AM
close form taylorosso Forms 5 08-25-2009 10:18 AM
How to I cancel and not save the changed data in a form. nkenney Forms 4 04-01-2009 09:48 AM
Form requesting to save changes stevo2820 Forms 0 07-30-2007 05:41 AM


All times are GMT -8. The time now is 02:42 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.