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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Correct visibility of fields on form depending on conditions
I have 3 conditions which affect the visibility of fields on a form.
Which form event will check these conditons and display the 3 fields correctly as I move from record to record? Right now I have these procedures running on the form after update event, but it doesn't work if I don't update the record I'm leaving. Field properties on form: Shipping.visible = true TotalCIP.visible = true CollectShipAct.Visible = false Form after update statement (only 1 of these 3 conditions can be true at a time based on field after update events): 'For FOB shipments, make shipping and CIP lines invisible If Shipped_FOB = -1 Then Shipping.Visible = False TotalCIP.Visible = False End If 'For CIP shipments, make shipping and CIP lines invisible If Shipped_CIP = -1 Then Shipping.Visible = False TotalCIP.Visible = False End If 'For collect shipments, make shipping and CIP lines invisible and also Display ship acct no. If Shipped_Collect = -1 Then Shipping.Visible = False TotalCIP.Visible = False CollectShipAct.Visible = True End If End Sub I'm beginning to wonder if it's even possible, and the logic sends me around in circles. Maybe that's what's happening to Access, too! By the way, I need to make these same conditions work on a report based on this form. Please comment if this is possible, too. Thanks. Sammie ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- |
#2
|
|||
|
|||
The basic idea would be to use the AfterUpdate event of the checkboxes(?) to
set the Visible properties of the controls. Also call the code in the Current event of the form (so it runs when you move record), and also the Undo event of the form (so it is reset correctly depending on the OldValue). It looks like you have 3 yes/no fields, and you are trying to ensure that the user can check only one. Would it be better to use a single Number field instead of the 3 yes/no fields? You could then use an option group with 3 check boxes it in, and then whenever the user checks one the others become unchecked. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Sammie" wrote in message ... I have 3 conditions which affect the visibility of fields on a form. Which form event will check these conditons and display the 3 fields correctly as I move from record to record? Right now I have these procedures running on the form after update event, but it doesn't work if I don't update the record I'm leaving. Field properties on form: Shipping.visible = true TotalCIP.visible = true CollectShipAct.Visible = false Form after update statement (only 1 of these 3 conditions can be true at a time based on field after update events): 'For FOB shipments, make shipping and CIP lines invisible If Shipped_FOB = -1 Then Shipping.Visible = False TotalCIP.Visible = False End If 'For CIP shipments, make shipping and CIP lines invisible If Shipped_CIP = -1 Then Shipping.Visible = False TotalCIP.Visible = False End If 'For collect shipments, make shipping and CIP lines invisible and also Display ship acct no. If Shipped_Collect = -1 Then Shipping.Visible = False TotalCIP.Visible = False CollectShipAct.Visible = True End If End Sub I'm beginning to wonder if it's even possible, and the logic sends me around in circles. Maybe that's what's happening to Access, too! By the way, I need to make these same conditions work on a report based on this form. Please comment if this is possible, too. Thanks. Sammie |
#3
|
|||
|
|||
Allen Browne wrote:
The basic idea would be to use the AfterUpdate event of the checkboxes(?) to set the Visible properties of the controls. Also call the code in the Current event of the form (so it runs when you move record), and also the Undo event of the form (so it is reset correctly depending on the OldValue). It looks like you have 3 yes/no fields, and you are trying to ensure that the user can check only one. Would it be better to use a single Number field instead of the 3 yes/no fields? You could then use an option group with 3 check boxes it in, and then whenever the user checks one the others become unchecked. WOW! This was VERY helpful. Thank you. I had forgotten all about option buttons! You have simplified everything. Sammie ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Additional fields for form based parameter query/null fields | geeksdoitbetter | Running & Setting Up Queries | 2 | January 7th, 2005 10:05 PM |
Date form fields in Word 2003 | Andy | General Discussion | 1 | November 11th, 2004 11:06 AM |
Weird Access 2K problems in a form | Chuck Chopp | Using Forms | 4 | September 1st, 2004 08:54 PM |
surely a form with a ListBox can be used in a query? | 1.156 | Running & Setting Up Queries | 14 | June 2nd, 2004 04:54 PM |