Toggle Button

  • Thread starter Thread starter Veli Izzet
  • Start date Start date
V

Veli Izzet

Hi All,

I want to use a toggle button on a form to input "Text1" when down, and
"Text2" when up in a control.

I would also like to change the caption to "Caption1" and "Caption2"
according to the value of that same control.

Thanks for any help..
 
Toggle buttons can only have numeric values, but you can use a table to
represent those values. Joining the table on the numeric value, will allow
displaying the text:

SELECT Table2.Data
FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID;

You can also write values to another control with the toggle:

Sub MyToggle_AfterUpdate()
If MyToggle = 2 ' Down Then
Me.txtBox1 = "Text1"
Me.MyToggle.Caption = "Caption2"
Else
Me.txtBox1 = "Text2"
Me.MyToggle.Caption = "Caption1"
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Veli Izzet said:
Thanks,

Does Toggle Button values only take 1 and 2? 1 for up and 2 for down?

Actually, a Toggle is a boolean control (True or False) with permissible
values of -1 and 0

If you use any value other than that it is treated as True (down) So the
code should really read:

If MyToggle = -1 Then
or
If MyToggle = True Then

My earlier post was in error.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top