PDA

View Full Version : [SOLVED:] How to use radio buttons on a form to input text into a table in access 2007?



sdhruv
06-10-2015, 08:47 PM
Hey I tried using radio buttons to update a text field but it only updates with the values of the buttons. I attempted a code but it doesn't work, the code is used is below:
If Complete.Value = True Then
[status].Value = "complete"
ElseIf Pending.Value = True Then
[status].Value = "pending"
ElseIf Cancelled.Value = True Then
[status].Value = "cancelled"
End If
End

Complete, Pending and Cancelled are the name of the radio buttons as well as the text I want to input, status is the field that I want to update. But there is no change it keeps showing values 1,2 and 3.

jonh
06-11-2015, 01:16 AM
Put the buttons in a frame


Private Sub Frame0_Click()
opt = Array("complete", "pending", "cancelled")
status.Value = opt(Frame0.Value - 1)
End Sub

sdhruv
06-11-2015, 03:26 AM
Thank you sir, you are a savior

sdhruv
06-14-2015, 09:17 PM
Hi, I am still having a small problem, it displays the text for the radio button I clicked on but it doesn't show that the radio button which has been selected on the form, which leads to a lot of confusion, is there anyway to solve that?

sdhruv
06-14-2015, 10:27 PM
sorry, I got it we need to use an unbound frame, and an hidden text box that will update the text to the table from the radio button selection with the following code:
Private Sub Frame90_AfterUpdate()
Select Case Frame90
Case 1
Me.status = "complete"
Case 2
Me.status = "pending"
Case 3
Me.status = "cancelled"
End Select
End Sub
Frame90 is the option group, and status is the hidden text box.