I can't see your attachmentI NEED to be with VBA
TO DO IT IN MY DATABASE ( ATTCHED IS EXAMPLE )
Have you tried to implement the solution offered by MajP in post #7need VBA
as following
if I select home =true
work = false
If select work =true
home false
automatically
I have two fields in my databaseNo, you don't. As the others have said, you need ONE field not two. Your condition is MUTUALLY EXCLUSIVE. That means only one can be true at a time. Using an option group, use 1 for Home and 2 for Work and whenever you need to determine work or home look for 1 or 2 in the SINGLE field. Using two fields only makes the process more complicated plus it violates third normal form. At some point, you should probably learn about how to design a database schema so that is the topic - "database normalization". Lots of stuff here and on other sites.
I fixed the database. The option group is the no code solution. Don't make things more complicated than they have to be. The additional benefit of the option group is if you add a third location such as "Client Site", just add a third option to the option group and add code where you need only people logged as "Client Site" which should be value = 3. No table changes are required. And query changes would only be required in the case where you wanted to select ONLY Location = 3 which I've defined as "Client Site".
FYI, when working with an option group, you always reference the frame control and NEVER reference the controls inside. So to refer to this control on the form, use Me.fraLocation, NOT check25 and check27
thanksI would probably go with
in an event like AfterUpdate for just what you are asking?Code:Me.Control = NOT Me.OtherControl
hatmak
OK. The attached db uses code to do as you requested.
BUT, as you have been advised, that this is NOT the best way to handle this data. I have to say that I'm not sure how much interest members will have in helping with any future issues that may arise from using this solution. Good luck with your project.
Well to be fair, I loaded the gun first,. I just put the bullets in back to front in error.I can't believe Bob loaded the gun for you.
It's not my faultI can't believe Bob loaded the gun for you.
All I did was turn the bullets aroundWell to be fair, I loaded the gun first,. I just put the bullets in back to front in error.
However from the previous posts of the o/p I could not see them listening to reason.![]()
many thanksI would probably go with
in an event like AfterUpdate for just what you are asking?Code:Me.Control = NOT Me.OtherControl