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
|
|||
|
|||
"Option Group" revisited
Hi. MVP Graham helped me with the first part of my "option
group" issue- I now have two option buttons: Member (option1) and Affiliate(option2) Each are yes/no fields, with an option group container, and code: Option1_Click Me!Option2 = Not Me!Option1 Option2_Click Me!Option1 = Not Me!Option2. If someone is a Member, I want MemberDate field required and AffiliateDate non-enterable. If someone is an Affiliate, I want AffiliateDate field requried and MemberDate non-enterable. MemberDate and AffiliateDate are Date/Time fields. Any suggestions? Thanks! Stephanie |
#2
|
|||
|
|||
It's late Sunday night so this is "air code" ... E & OE .. ok
If Option1 Then AffiliateDateNAME.Enabled = False AffiliateDateNAME.Locked = True I have emphasised NAME like that because the Name of a control is what Access refers to, not to the field name inside it. For this reason, when both are the same (which is the MS default) Access gets confused and you get odd results or the code doesn't work at all. For this reason, all controls on a form ought to be manually renamed using a Naming Convention that makes a distinction between the Name (Design View-Properties-Other-Name) and the ControlSource. we generally use txt, num, dte, cbo, opt, cmd, lbl as the main ones. Using num for numerical fields is not entirely kosher as in a high level multi-developer environment, one should be explicit with lng, dbl, sgl, pct, cur etc but we find this is mostly just an overkill in an Access database. Perhaps our way is just a little lazy, I don't know, it works for us ok. Brett On Sat, 30 Oct 2004 16:21:37 -0700, "Stephanie" wrote: Hi. MVP Graham helped me with the first part of my "option group" issue- I now have two option buttons: Member (option1) and Affiliate(option2) Each are yes/no fields, with an option group container, and code: Option1_Click Me!Option2 = Not Me!Option1 Option2_Click Me!Option1 = Not Me!Option2. If someone is a Member, I want MemberDate field required and AffiliateDate non-enterable. If someone is an Affiliate, I want AffiliateDate field requried and MemberDate non-enterable. MemberDate and AffiliateDate are Date/Time fields. Any suggestions? Thanks! Stephanie Cheers, Brett ---------------------------------------------- Be adventurous, be bold, be careful, be a star ---------------------------------------------- Brett Collings Business & Systems Analyst Management Information Systems Developer |
#3
|
|||
|
|||
Brett,
Thanks for the reply and Happy Halloween! Thanks for the control naming lesson- I appreciate it. I'm sure my database and field names scare the professionals. I'm still a bit confused with the code. What field would I attach it to and to which event? Seems as though I'd attach the code to be somehow associated with the Member field so that the AffiliateDateName field is disabled, and that the trigger needs to happen after the Member field is populated. I tried to embed it along wiht the Option1_Click() code, but it didn't work correctly. Events and coding are a struggle for me. Thanks and what are you doing writing air code at 2 AM anyway? Stephanie -----Original Message----- It's late Sunday night so this is "air code" ... E & OE .. ok If Option1 Then AffiliateDateNAME.Enabled = False AffiliateDateNAME.Locked = True I have emphasised NAME like that because the Name of a control is what Access refers to, not to the field name inside it. For this reason, when both are the same (which is the MS default) Access gets confused and you get odd results or the code doesn't work at all. For this reason, all controls on a form ought to be manually renamed using a Naming Convention that makes a distinction between the Name (Design View-Properties-Other-Name) and the ControlSource. we generally use txt, num, dte, cbo, opt, cmd, lbl as the main ones. Using num for numerical fields is not entirely kosher as in a high level multi-developer environment, one should be explicit with lng, dbl, sgl, pct, cur etc but we find this is mostly just an overkill in an Access database. Perhaps our way is just a little lazy, I don't know, it works for us ok. Brett On Sat, 30 Oct 2004 16:21:37 -0700, "Stephanie" wrote: Hi. MVP Graham helped me with the first part of my "option group" issue- I now have two option buttons: Member (option1) and Affiliate(option2) Each are yes/no fields, with an option group container, and code: Option1_Click Me!Option2 = Not Me!Option1 Option2_Click Me!Option1 = Not Me!Option2. If someone is a Member, I want MemberDate field required and AffiliateDate non-enterable. If someone is an Affiliate, I want AffiliateDate field requried and MemberDate non-enterable. MemberDate and AffiliateDate are Date/Time fields. Any suggestions? Thanks! Stephanie Cheers, Brett ---------------------------------------------- Be adventurous, be bold, be careful, be a star ---------------------------------------------- Brett Collings Business & Systems Analyst Management Information Systems Developer . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Option Group to Preview/Print Reports | Tia | Using Forms | 1 | August 16th, 2004 02:17 AM |
Unbound option group writing text values... | Davie P | Using Forms | 5 | August 12th, 2004 03:49 PM |
Autofill an option group based on a date field. | Tara | Using Forms | 1 | July 29th, 2004 09:22 PM |
option group | troy | Using Forms | 4 | June 23rd, 2004 11:51 PM |
Like Option group | Matt | Using Forms | 0 | May 25th, 2004 08:16 PM |