Toggle Button Basics

I've never used a toggle button on a form and cannot find a clear, basic intro.  I have a form based on a table.  One of the fields is the Y/N Boolean type.  The form (call it B) is based on a query that filters to the desired record (based on selections in a prior form (call it A).)   The user will be allowed to modify certain of the fields in the underlying record, one of which is the Boolean.  I'd like to use a toggle button to allow them to "switch" the choice (in this case a -1 (True/Yes) = "Open", and 0 (False/No) = "Closed"   If you can point me to a decent intro. on how to set this up, I'd appreciate it.  Thanks!
mcnAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike EghtebasDatabase and Application DeveloperCommented:
See if you can use this information, I didn't quite your question:

Have a toggle button fotm the tool bar.

In its caption enter "See Table B"  assuming you are by default seeing Table A.

In the on click event of the toggle button (say nammed toggle1) have

If toggle1= false then 'false means it is up not pressed
  me!toggle1.caption = "See Table B"
Else
  me!toggle1.caption = "See Table A"
End If

Mike
0
Mike EghtebasDatabase and Application DeveloperCommented:
If toggle1= false then 'false means it is up not pressed
  me!toggle1.caption = "See Table B"
  'run code 1
Else
  me!toggle1.caption = "See Table A"
    'run code 2
End If
0
RyanProject Engineer, ElectricalCommented:
If you use the option frame button, the wizard should be pretty simple.
I think I would use a command button though. Setting the buttons caption based on that boolean field.

Similar to eghtebas' 2nd suggestion.

cmdButton.caption = iif(Field1,"Open",Closed")    

Put this code in the cmdButton_Click event and also form_current (so it'll set the command button text when you go to new records)
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Mike EghtebasDatabase and Application DeveloperCommented:
the reason I gave the expanded version so it:

If toggle1= false then 'false means it is up not pressed
  me!toggle1.caption = "See Table B"
  'run code 1
Else
  me!toggle1.caption = "See Table A"
    'run code 2
End If

to include actions to perform.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mcnAuthor Commented:
Wording was somewhat cryptic.  Otherwise right on!
0
RyanProject Engineer, ElectricalCommented:
Thats fine. I was just giving alternative methods. (Forgot the line to toggle the field value though). 2 Lines vs 7, options are good.

Field1 = not field1
cmdButton.caption = iif(Field1,"Open",Closed")
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.