combo and radio button

C

Chetan I. Rathi

Hi,

It is very difficult for me to explain in words so I will try to explain
situation with an example

tbl1
comb1 = A, B, C (This is a combo field in a tbl1 with three options)

I want to represent this thing in frm1 by radio button. I tried to create
option-group-1 with three options. In record source property of
option-group-1, comb1 was selected.

1. If I want to add new record, I should be able to do by selecting
option-1 then ‘A’ should be added in tbl1 and so on. I don’t know how to do
this?
2. Similary if I should be able to view items stored in tbl1 with
corrosponding radio button in frm1?

I hope I am clear because I don’t know how to explain situation.
Thanking advance for your support
Rathi
 
W

Wayne-I-M

Hi Chetan

Open your form in design view.
Create an option group with 3 buttons
Save the form
Right click the option group
Open the properties box
Select AfterUpdate
Select build (...)
Select code
You will see this

Private Sub FrameName_AfterUpdate()

End Sub

You need to add code to each possible case - if you select option 1 2 or 3.

Like this

Private Sub FrameName_AfterUpdate()
Select Case Me!FrameName
Case 1
Case 2
Case 3
End Select
End Sub

You need to code the action your form will take if certain "cases" are
slected in the option group (that is you press a certain button) So, say you
wanted to set the value of a control (txtSomething) if you select option 1,
Add a new record if you select option 2 and, if you select option 3 you want
to change the back colour of a text box (txtAnotherBox) to red and change the
font colour to yellow. You could wirte the code like this

Private Sub FrameName_AfterUpdate()
Select Case Me!FrameName
Case 1
Me.txtSomething = "some text)
Case 2
DoCmd.GoToRecord , , acNewRec
Case 3
Me.txtAnotherBox.BackColor = vbRed
Me.txtAnotherBox.ForeColor = vbYellow
End Select
End Sub

I hope you understand the general idea. You can set "things" to happen if
you select a certain option in the option group. You will need to play
around with it to get it to do just what you want but I hope this points you
in the right direction.

Hope this helps - good luck
 

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

Top