Toggle Buttons

tnago

Registered User.
Local time
Today, 11:51
Joined
May 2, 2003
Messages
15
I am trying to use a toggle button on a form to update the value of a record in the database. I want to have a button whose default state is Open and when toggled changed to Close and update the corresponding record in the database. Any help will be greatly appreciated.
 
Create the toggle button using the Control Wizard in form design. It should step you through all of these choices for you.
 
Sorry to ask this question, however when you say to use control wizard you mean tool box? Or is it something else. I am new to Access so this question might look stupid to experienced user.
 
No problem. The control wizard option controlled by one of the buttons in the toolbox itself. It looks like a magic wand. Clicking the button itself doesn't do much, it just selects or de-selects it.

When you turn on the control wizard option though, then select a control from the toolbox, then place that control onto your form, Access will bring up a wizard stepping you through a bunch of choices for the control.
 
I am sorry to bug again, however I am unable to lauch the control wizard for some reason. The Select Object option remains active even when I select the magic wand, as a result when the control is put on the form the button can only be configured through the 'properties' option. Any suggestion what I am doing wrong? I tried this on both 2002 and 2000 version with the same results.
 
Crap. I think I've misled you. I just did some research in the Access XP help file. Seems there is no Toggle Button wizard. Very strange, as I thought there was one. There is a combo box, list box and option group wizard but I don't think there's one for a toggle button. Very sorry about that.

Toggle buttons are best used for true/false conditions. You can place on onto your form, then set the controlsource to your true/false field. The field would then be true if the toggle button is pressed and false otherwise.
 
I have tried what Tim suggested but I am getting runtime error. This how I have it in the database.

=======================================
Private Sub Toggle141_Click()
If Me.Toggle141 = -1 Then 'if pressed in
Me.Text73 = "This"
Me.Toggle141.Caption = "Closed"
Else
Me.Text73 = "That"
Me.Toggle141.Caption = "Open"
End If
=======================================
I am new to Access and VB and as such I am not sure what the problem is . Maybe someone with more experience can advise what I am doing wrong? I am not sure what field is associated with textboxNameX, is it the CLOSED field in the database? If it is then am I suppose to hide it as I just want to show Status through toggle button.
 
Hi Tim

Thanks for your responses. I was able to get the desired result by modifying somewhat the code that you suggested. I do appreciate your feedback.

In my case I was trying to duplicate a VB front end functionality which was not working in win2000 enviornment. The person who developed the front end was not working in our group anymore so I tried to do the same things through a form. I will readily admit that I am not a programmer and being relative new to access, was not able to grasp all requirements of VB codes as well different events which could impact the excecution of the code.

I like to thank everyone who provided their help in resolving different issues that I had.
 

Users who are viewing this thread

Back
Top Bottom