"Option Group" revisited

  • Thread starter Thread starter Stephanie
  • Start date Start date
S

Stephanie

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
 
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

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
 
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
 
Back
Top