Update textbox from option group

E

Erin

I have a form and a subform. The option group is in the subform, and I want
to update a text box on the form based on the selection in the option group.
So if the user chooses option 1, I want the textbox to show "Completed";
option 2 -- "Not Completed"; option 3 -- "Not Started".

I've tried using the "After Update" event with

Case 1
Form!textbox = "Completed" etc...

But this doesn't work -- what syntax should I use, or is it not possible to
fill a textbox on a form from an option group selection on the subform?

Thanks!
 
J

John W. Vinson

I have a form and a subform. The option group is in the subform, and I want
to update a text box on the form based on the selection in the option group.
So if the user chooses option 1, I want the textbox to show "Completed";
option 2 -- "Not Completed"; option 3 -- "Not Started".

I've tried using the "After Update" event with

Case 1
Form!textbox = "Completed" etc...

But this doesn't work -- what syntax should I use, or is it not possible to
fill a textbox on a form from an option group selection on the subform?

Thanks!

Try using Parent!textbox instead of Form!textbox.

The problem I see is that you might have many records displayed on the
subform, some completed, some not started, etc. - WHICH record should the
mainform reflect???
 
E

Erin

Hi John,

I appreciate your help. Here is the actual code that I'm using:

Private Sub OptionSummary_AfterUpdate()
Select Case Me.OptionSummary
Case 1
frmActionPlantest.txtOptionSummary = "Not Started"
Case 2
frmActionPlantest.txtOptionSummary = "Complete"
Case 1
frmActionPlantest.txtOptionSummary = "Not Complete"
Case Else
frmActionPlantest.txtOptionSummary = "Please check a Summary box option"
End Select
End Sub


I have it in the After Update event for the option group in the subform --
wouldn't having it there specify which record the parent form text box should
reflect? The "frmActionPlantest" is the parent form, and the
txtOptionSummary is the textbox on the parent form. I want that textbox to
fill with the results (1,2,3) of the option group (the "OptionSummary" listed
in the code). Hopefully that makes sense!

When I click on one of the option boxes, I get "object required", so I guess
I'm missing something simple.
 
J

John W. Vinson

Hi John,

I appreciate your help. Here is the actual code that I'm using:

Private Sub OptionSummary_AfterUpdate()
Select Case Me.OptionSummary
Case 1
frmActionPlantest.txtOptionSummary = "Not Started"
Case 2
frmActionPlantest.txtOptionSummary = "Complete"
Case 1
frmActionPlantest.txtOptionSummary = "Not Complete"
Case Else
frmActionPlantest.txtOptionSummary = "Please check a Summary box option"
End Select
End Sub


I have it in the After Update event for the option group in the subform --
wouldn't having it there specify which record the parent form text box should
reflect? The "frmActionPlantest" is the parent form, and the
txtOptionSummary is the textbox on the parent form. I want that textbox to
fill with the results (1,2,3) of the option group (the "OptionSummary" listed
in the code). Hopefully that makes sense!

When I click on one of the option boxes, I get "object required", so I guess
I'm missing something simple.

The syntax would be either

Parent.txtOptionSummary = "Not Started"

or

Forms!frmActionPlantest.txtOptionSummary = "Not Started"

However my concern remains: typically (and I know, your form may not be
typical!) a form/subform arrangement has a Form based on the "one" side of a
one to many relationship, and a Subform based on the "many" side. As such
there is only one textbox txtOptionSummary, but there are (potentially) many
records in the subform, each with its own option group, and those option
groups could all have different values! You ask "wouldn't having it there
specify which record the parent form text box should reflect?", but there
would (again, typically) be ONLY ONE RECORD on the parent form, related to
many records on the child form.
 

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

Similar Threads

textbox event 2
Access Create option group without using wizard? 2
OPtion Group 3
Is this possible? Pt II 1
I need some option group help! 1
Query Parameter using multiple options 0
Option Group Auto Open 5
option group 1

Top