Option Group selection on open

A

Anne

I have an options group:
Private Sub JobSelectJobOption_AfterUpdate()
Select Case JobSelectJobOption
Case 1
Me.JobSelect.RowSource = "Select * from cbojobcontractor where [Archive]
=False "
Case 2
Me.JobSelect.RowSource = "Select * from cbojobcontractor where [Archive]
=true "
Case 3
Me.JobSelect.RowSource = "Select * from cbojobcontractor"
Me.requery
End Select
End Sub

It works, however, whenever I open the form, case 3 is selected which should
be all jobs, but it does not list all jobs, it lists the active jobs.
It shows all job, but displays only the active jobs. I have to check another
button and then again all jobs to actually display all jobs.
In any case, it should display which ever button is checked.
 
M

Mr. B

Anne,

If when you open your form the 3rd option is selected, then either you have
set the default of your group control to 3 or some code is setting that value.

As for the recrods not displaying, you need to move the Me.Requery to after
the End Select of your Case statement if you want the form to be requery
after the group control is updated.

HTH
Mr. B
askdoctoraccess dot com
 
A

Anne

It has been so long since I worked with an options group that I forgot. I
found that the default value of the group was set to 3. This options group is
for a combobox.

For a quick solution I made the default value 1. Now, at least, the checked
item corresponds to the values shown when the form opens. I moved the
me.requery to the right spot.


Mr. B said:
Anne,

If when you open your form the 3rd option is selected, then either you have
set the default of your group control to 3 or some code is setting that value.

As for the recrods not displaying, you need to move the Me.Requery to after
the End Select of your Case statement if you want the form to be requery
after the group control is updated.

HTH
Mr. B
askdoctoraccess dot com

Anne said:
I have an options group:
Private Sub JobSelectJobOption_AfterUpdate()
Select Case JobSelectJobOption
Case 1
Me.JobSelect.RowSource = "Select * from cbojobcontractor where [Archive]
=False "
Case 2
Me.JobSelect.RowSource = "Select * from cbojobcontractor where [Archive]
=true "
Case 3
Me.JobSelect.RowSource = "Select * from cbojobcontractor"
Me.requery
End Select
End Sub

It works, however, whenever I open the form, case 3 is selected which should
be all jobs, but it does not list all jobs, it lists the active jobs.
It shows all job, but displays only the active jobs. I have to check another
button and then again all jobs to actually display all jobs.
In any case, it should display which ever button is checked.
 
L

Linq Adams via AccessMonster.com

The problem is that you're setting the 3rd option as being selected on
loading the form, and you expect this to cause the AfterUpdate event to fire,
and it won't!

AfterUpdate will only fire if the selection is made ***manually*** not if
it's made thru code or by setting a default value.

In you Form_Load event you'll need to call the AfterUpdate event with

Call JobSelectJobOption_AfterUpdate()

This should give you the results you expect.
 
A

Anne

From my experience, the error message of 'invalid use of null' leads back to
the data. Perhaps in the conversion, something did not convert property and
there are errors in the underlying query.Check out the query data for errors.
 
A

Anne

Sorry, this got into the wrong message.

Anne said:
From my experience, the error message of 'invalid use of null' leads back to
the data. Perhaps in the conversion, something did not convert property and
there are errors in the underlying query.Check out the query data for errors.

Anne said:
I have an options group:
Private Sub JobSelectJobOption_AfterUpdate()
Select Case JobSelectJobOption
Case 1
Me.JobSelect.RowSource = "Select * from cbojobcontractor where [Archive]
=False "
Case 2
Me.JobSelect.RowSource = "Select * from cbojobcontractor where [Archive]
=true "
Case 3
Me.JobSelect.RowSource = "Select * from cbojobcontractor"
Me.requery
End Select
End Sub

It works, however, whenever I open the form, case 3 is selected which should
be all jobs, but it does not list all jobs, it lists the active jobs.
It shows all job, but displays only the active jobs. I have to check another
button and then again all jobs to actually display all jobs.
In any case, it should display which ever button is checked.
 
L

Linq Adams via AccessMonster.com

I'm glad you posted this last message! I thought maybe I'd mixed up my
medication and was having hallucinations!

I take it the problem posted in this thread is now resolved?
 

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