Unbound option groups and form's RecordSource in Access 2007

C

Carl Rapson

I have a form that contains unbound option groups and an unbound combo box
in the form header section. The form itself is bound to a query, but in the
Load event I set the form's RecordSource to something like:

SELECT * FROM [query] WHERE FALSE;

This has the effect of hiding all of the data fields on the form, leaving
only the option groups and combo box showing. The option groups are used to
limit the items that show in the combo box, and the combo box is used to
select an item to view on the form. When a selection is made in the combo
box, the form's RecordSource is modified to fetch that record and the fields
"magically" appear on the form. The two option gropups have default values
associated with them, that provide the initial list of items in the combo
box.

Under Access 2002, the two option groups would show their default values
selected even when the form first opens (no record in the form's
RecordSource). Under Access 2007, however, the option groups appear like
they do in form design view - there is no obvious selection, and each radio
button in the groups is "grayed", even the current selection. The option
groups aren't disabled because the user can click on a radio button,
however, and the click registers and the combo box updates accordingly. But
the current selections in the option groups don't show until an items is
selected in the combo box and a record appears on the form. So it appears
that the unbound option groups are connected somehow to the form's
RecordSource.

Has anyone else noticed this? Is this by design? Does anyone have any ideas
about how to make this work like it did under Access 2002, or alternatively
another way to accomplish the same thing?

Thanks for any information,

Carl Rapson
 
A

Albert D. Kallal

I had a number of forms where I use the "trick", or kluge of setting the
forms
reocrdset to something that returns no values.
SELECT * FROM [query] WHERE FALSE;

This has the effect of hiding all of the data fields on the form, leaving
only the option groups and combo box showing.

I had many problems doing the aobve, and I noticed that he combo boxs tend
to be ill behavhed. In other words, when you set the forms reocrdsouce to
nothing, even the un-bound contorls seemed un happy. (talking about
a2000-a2003).
Has anyone else noticed this? Is this by design? Does anyone have any
ideas about how to make this work like it did under Access 2002, or
alternatively another way to accomplish the same thing?

I had the same problem in a2003, and i can't quite 100% pin dow what the
problem was.

However, I dumped the use of the kluge query, and now go:

Private Sub MyVisiable(bolVisiable As Boolean)

Dim vt As Control

For Each vt In Me.Detail.Controls
vt.Visible = bolVisiable
Next vt

End Sub


So, in my load routinme, I go:

Call MyVisiable(false)

Then, in the combo box (or option group) after update event I will go:

.....seach/query update code...

Call Myvisiable(True)
Thanks for any information,

I have to play with my example a bit more...as I also have a good number of
continues forms that have "search" controls on the forms heading..and
details that are continues. Even in

I found the above tends to work the best..and my controls on the heading
don't go wonky.

One thing to try is the following:

Me.RecordSource = ""
Me.Refresh

Putting the above in seemed to restore the controls in the heading back to
normal. And, since I use the Myvisable code, then the details fields don't
display.
 
C

Carl Rapson

Albert,

Thanks for the tips. I'll go through them and see if they give me a
work-around. Up until now, I never had a problem with the "kludge", as you
call it. I guess I was just lucky.

Carl Rapson

Albert D. Kallal said:
I had a number of forms where I use the "trick", or kluge of setting the
forms
reocrdset to something that returns no values.
SELECT * FROM [query] WHERE FALSE;

This has the effect of hiding all of the data fields on the form, leaving
only the option groups and combo box showing.

I had many problems doing the aobve, and I noticed that he combo boxs tend
to be ill behavhed. In other words, when you set the forms reocrdsouce to
nothing, even the un-bound contorls seemed un happy. (talking about
a2000-a2003).
Has anyone else noticed this? Is this by design? Does anyone have any
ideas about how to make this work like it did under Access 2002, or
alternatively another way to accomplish the same thing?

I had the same problem in a2003, and i can't quite 100% pin dow what the
problem was.

However, I dumped the use of the kluge query, and now go:

Private Sub MyVisiable(bolVisiable As Boolean)

Dim vt As Control

For Each vt In Me.Detail.Controls
vt.Visible = bolVisiable
Next vt

End Sub


So, in my load routinme, I go:

Call MyVisiable(false)

Then, in the combo box (or option group) after update event I will go:

....seach/query update code...

Call Myvisiable(True)
Thanks for any information,

I have to play with my example a bit more...as I also have a good number
of continues forms that have "search" controls on the forms heading..and
details that are continues. Even in

I found the above tends to work the best..and my controls on the heading
don't go wonky.

One thing to try is the following:

Me.RecordSource = ""
Me.Refresh

Putting the above in seemed to restore the controls in the heading back to
normal. And, since I use the Myvisable code, then the details fields don't
display.
 

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