Enabling combobox based on output of option group, and how to filtera report

L

Lostguy

Hello!

Two questions:

a) I have an option group with 2 radio buttons. If the output is 1, I
want combobox to disable. If the output is two, I want it enabled.

I have put the "If opgroup.value=1 then combobox.enabled=false End if"
in the Form_Current, the Form_AfterUpdate(), the Opgroup_BeforeUpdate
(), and the opgroup_AfterUpdate(). Yes, this is overkill, but the
problem I am having is that when I go from one record to another, the
combobox that is disabled previously becomes enabled.

So, where do I put my code so that whatever I do, and how crazy I go
through the records, the combobox will always reflect what the option
group's output is?

b) I have report that gets it data straight from the table and not
from a query. I know this is probably bad form, but.... for the field
"StorageNumber", I only want to display on the report the numbers that
have the first 3 letters as "ACT". If I run a query based on the
table, I can just put left() in the SQL statement. Is there someplace
to put the left() for a report that has its controlsource as the table
rather than a query?

Stumped and Lost

VR/
Lost
 
T

tina

comments inline.

Lostguy said:
Hello!

Two questions:

a) I have an option group with 2 radio buttons. If the output is 1, I
want combobox to disable. If the output is two, I want it enabled.

I have put the "If opgroup.value=1 then combobox.enabled=false End if"
in the Form_Current, the Form_AfterUpdate(), the Opgroup_BeforeUpdate
(), and the opgroup_AfterUpdate(). Yes, this is overkill, but the
problem I am having is that when I go from one record to another, the
combobox that is disabled previously becomes enabled.

well, i think you only need the code in the form's Current event procedure,
and the option group control's AfterUpdate event procedure. i notice two
things about your If statement: 1) there is no instruction on enabling the
combobox control when the option group control's value = 2, and 2) there is
no instruction at all for scenarios where the option group control's value
is Null. suggest you try the following "toggle" code, which will take care
of all three scenarios, as

Me!ComboBoxControlName.Enabled = Not (Me!OptionGroupControlName = 1)

replace the dummy control names i used, with the "real" names of your
controls. the code will disable the combobox when the option group = 1, and
enable it otherwise.
So, where do I put my code so that whatever I do, and how crazy I go
through the records, the combobox will always reflect what the option
group's output is?

b) I have report that gets it data straight from the table and not
from a query. I know this is probably bad form, but.... for the field
"StorageNumber", I only want to display on the report the numbers that
have the first 3 letters as "ACT". If I run a query based on the
table, I can just put left() in the SQL statement. Is there someplace
to put the left() for a report that has its controlsource as the table
rather than a query?

take a look at the report Filter and FilterOn properties in Access Help.

hth
 

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