cascading combo boxes requery problem

G

Guest

I have three combo boxes cboQuartile, cboRating, cboIncreasePercent. The user
selects a quartile and then a rating and then an increase percent. This part
works fine, but when I move to the next record it doesn't requery. I've
received lots of help getting this far and I need a little more to get over
the hump. I in over my head and could use some help. Thanks in advance. This
is what I have so far

Private Sub cboQuartile_AfterUpdate()
Me!cboRating = Null
Me!cboRating.Requery
On Error Resume Next
cboRating.RowSource = "Select Distinct [Increases6-18].Rating " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Quartile = " & cboQuartile.Value & " " & _
"Order By [Increases6-18].Rating;"
Me!cboRating.Requery
End Sub

Private Sub cboRating_AfterUpdate()
Me!cboIncreasePercent = Null
Me!cboIncreasePercent.Requery
On Error Resume Next
Me!cboIncreasePercent.RowSource = _
"Select Distinct [Increases6-18].Increase_Percent " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Rating = '" & Me!cboRating & "' " & _
"AND [Increases6-18].Quartile = " & Me!cboQuartile & _
" Order By [Increases6-18].Increase_Percent;"

End Sub

Private Sub Form_Current()
cboQuartile.Requery
cboRating.Requery
cboIncreasePercent.Requery
 
G

Guest

Well, it seems like your over coding here. Your SQL statement "Select
Distinct......etc." should be contained in the row source of your como box.
You shouldn't need to "rebuild" it everytime the After Update event runs.
Also, you are doing your requery multiple times on each field, which is also
unnecessary. When you say it doesn't requery, which part doesn't requery?
You've got so many in your code it's a little hard to tell what you mean.
 
G

Guest

Thanks Beetle for responding. When moving from one record to the next the
fields contain the same selections from the first record. When the form opens
each field is blank and after I make the choices in the first record all of
the records after that have the same fields selected. i know I'm in over my
head, but this project was kind of thrust on me and I need all the help I can
get. Thanks.

Talib
--
tm


Beetle said:
Well, it seems like your over coding here. Your SQL statement "Select
Distinct......etc." should be contained in the row source of your como box.
You shouldn't need to "rebuild" it everytime the After Update event runs.
Also, you are doing your requery multiple times on each field, which is also
unnecessary. When you say it doesn't requery, which part doesn't requery?
You've got so many in your code it's a little hard to tell what you mean.

talibm said:
I have three combo boxes cboQuartile, cboRating, cboIncreasePercent. The user
selects a quartile and then a rating and then an increase percent. This part
works fine, but when I move to the next record it doesn't requery. I've
received lots of help getting this far and I need a little more to get over
the hump. I in over my head and could use some help. Thanks in advance. This
is what I have so far

Private Sub cboQuartile_AfterUpdate()
Me!cboRating = Null
Me!cboRating.Requery
On Error Resume Next
cboRating.RowSource = "Select Distinct [Increases6-18].Rating " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Quartile = " & cboQuartile.Value & " " & _
"Order By [Increases6-18].Rating;"
Me!cboRating.Requery
End Sub

Private Sub cboRating_AfterUpdate()
Me!cboIncreasePercent = Null
Me!cboIncreasePercent.Requery
On Error Resume Next
Me!cboIncreasePercent.RowSource = _
"Select Distinct [Increases6-18].Increase_Percent " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Rating = '" & Me!cboRating & "' " & _
"AND [Increases6-18].Quartile = " & Me!cboQuartile & _
" Order By [Increases6-18].Increase_Percent;"

End Sub

Private Sub Form_Current()
cboQuartile.Requery
cboRating.Requery
cboIncreasePercent.Requery
 
D

Douglas J. Steele

When I worked with you earlier, you said it wasn't a continuous form! What
you're describing is exactly how continuous forms work, and why I wrote the
article about how to solve the problem that you said you already downloaded.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


talibm said:
Thanks Beetle for responding. When moving from one record to the next the
fields contain the same selections from the first record. When the form
opens
each field is blank and after I make the choices in the first record all
of
the records after that have the same fields selected. i know I'm in over
my
head, but this project was kind of thrust on me and I need all the help I
can
get. Thanks.

Talib
--
tm


Beetle said:
Well, it seems like your over coding here. Your SQL statement "Select
Distinct......etc." should be contained in the row source of your como
box.
You shouldn't need to "rebuild" it everytime the After Update event runs.
Also, you are doing your requery multiple times on each field, which is
also
unnecessary. When you say it doesn't requery, which part doesn't requery?
You've got so many in your code it's a little hard to tell what you mean.

talibm said:
I have three combo boxes cboQuartile, cboRating, cboIncreasePercent.
The user
selects a quartile and then a rating and then an increase percent. This
part
works fine, but when I move to the next record it doesn't requery. I've
received lots of help getting this far and I need a little more to get
over
the hump. I in over my head and could use some help. Thanks in advance.
This
is what I have so far

Private Sub cboQuartile_AfterUpdate()
Me!cboRating = Null
Me!cboRating.Requery
On Error Resume Next
cboRating.RowSource = "Select Distinct [Increases6-18].Rating " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Quartile = " & cboQuartile.Value & " " & _
"Order By [Increases6-18].Rating;"
Me!cboRating.Requery
End Sub

Private Sub cboRating_AfterUpdate()
Me!cboIncreasePercent = Null
Me!cboIncreasePercent.Requery
On Error Resume Next
Me!cboIncreasePercent.RowSource = _
"Select Distinct [Increases6-18].Increase_Percent " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Rating = '" & Me!cboRating & "' " & _
"AND [Increases6-18].Quartile = " & Me!cboQuartile & _
" Order By [Increases6-18].Increase_Percent;"

End Sub

Private Sub Form_Current()
cboQuartile.Requery
cboRating.Requery
cboIncreasePercent.Requery
 
G

Guest

Sorry Doug I must have misunderstood what you meant about a continuous form.
I am obviously in over my head. I'll ake another look at the article. Thanks
--
tm


Douglas J. Steele said:
When I worked with you earlier, you said it wasn't a continuous form! What
you're describing is exactly how continuous forms work, and why I wrote the
article about how to solve the problem that you said you already downloaded.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


talibm said:
Thanks Beetle for responding. When moving from one record to the next the
fields contain the same selections from the first record. When the form
opens
each field is blank and after I make the choices in the first record all
of
the records after that have the same fields selected. i know I'm in over
my
head, but this project was kind of thrust on me and I need all the help I
can
get. Thanks.

Talib
--
tm


Beetle said:
Well, it seems like your over coding here. Your SQL statement "Select
Distinct......etc." should be contained in the row source of your como
box.
You shouldn't need to "rebuild" it everytime the After Update event runs.
Also, you are doing your requery multiple times on each field, which is
also
unnecessary. When you say it doesn't requery, which part doesn't requery?
You've got so many in your code it's a little hard to tell what you mean.

:

I have three combo boxes cboQuartile, cboRating, cboIncreasePercent.
The user
selects a quartile and then a rating and then an increase percent. This
part
works fine, but when I move to the next record it doesn't requery. I've
received lots of help getting this far and I need a little more to get
over
the hump. I in over my head and could use some help. Thanks in advance.
This
is what I have so far

Private Sub cboQuartile_AfterUpdate()
Me!cboRating = Null
Me!cboRating.Requery
On Error Resume Next
cboRating.RowSource = "Select Distinct [Increases6-18].Rating " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Quartile = " & cboQuartile.Value & " " & _
"Order By [Increases6-18].Rating;"
Me!cboRating.Requery
End Sub

Private Sub cboRating_AfterUpdate()
Me!cboIncreasePercent = Null
Me!cboIncreasePercent.Requery
On Error Resume Next
Me!cboIncreasePercent.RowSource = _
"Select Distinct [Increases6-18].Increase_Percent " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Rating = '" & Me!cboRating & "' " & _
"AND [Increases6-18].Quartile = " & Me!cboQuartile & _
" Order By [Increases6-18].Increase_Percent;"

End Sub

Private Sub Form_Current()
cboQuartile.Requery
cboRating.Requery
cboIncreasePercent.Requery
 
G

Guest

Ok, Doug I've reread the article and my form is not a continuous form. This
how I want to use the merit increase form I'm trying to create. The
supervisor selects one of the workers he/she supervises (Employees form).
From the merit increase subform the supervisor selects the quartile (1-4),
the rating (Competent, Distinguished, etc) and the increase percent. Then the
supervisor would go to the next employees and the merit increase form should
reset for the next employee's record. I hope that this helps explain what I'm
trying to accomplish.
--
tm


talibm said:
Sorry Doug I must have misunderstood what you meant about a continuous form.
I am obviously in over my head. I'll ake another look at the article. Thanks
--
tm


Douglas J. Steele said:
When I worked with you earlier, you said it wasn't a continuous form! What
you're describing is exactly how continuous forms work, and why I wrote the
article about how to solve the problem that you said you already downloaded.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


talibm said:
Thanks Beetle for responding. When moving from one record to the next the
fields contain the same selections from the first record. When the form
opens
each field is blank and after I make the choices in the first record all
of
the records after that have the same fields selected. i know I'm in over
my
head, but this project was kind of thrust on me and I need all the help I
can
get. Thanks.

Talib
--
tm


:

Well, it seems like your over coding here. Your SQL statement "Select
Distinct......etc." should be contained in the row source of your como
box.
You shouldn't need to "rebuild" it everytime the After Update event runs.
Also, you are doing your requery multiple times on each field, which is
also
unnecessary. When you say it doesn't requery, which part doesn't requery?
You've got so many in your code it's a little hard to tell what you mean.

:

I have three combo boxes cboQuartile, cboRating, cboIncreasePercent.
The user
selects a quartile and then a rating and then an increase percent. This
part
works fine, but when I move to the next record it doesn't requery. I've
received lots of help getting this far and I need a little more to get
over
the hump. I in over my head and could use some help. Thanks in advance.
This
is what I have so far

Private Sub cboQuartile_AfterUpdate()
Me!cboRating = Null
Me!cboRating.Requery
On Error Resume Next
cboRating.RowSource = "Select Distinct [Increases6-18].Rating " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Quartile = " & cboQuartile.Value & " " & _
"Order By [Increases6-18].Rating;"
Me!cboRating.Requery
End Sub

Private Sub cboRating_AfterUpdate()
Me!cboIncreasePercent = Null
Me!cboIncreasePercent.Requery
On Error Resume Next
Me!cboIncreasePercent.RowSource = _
"Select Distinct [Increases6-18].Increase_Percent " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Rating = '" & Me!cboRating & "' " & _
"AND [Increases6-18].Quartile = " & Me!cboQuartile & _
" Order By [Increases6-18].Increase_Percent;"

End Sub

Private Sub Form_Current()
cboQuartile.Requery
cboRating.Requery
cboIncreasePercent.Requery
 
G

Guest

After some trial and error this is what I have now. I hope that this helps
you guys/gals help me. This has been a real striuggle. I moved the queries to
the RowSource for my combo boxes. This is what I have now.
cbrQuartile RowSource
SELECT DISTINCT [Increases6-18].Quartile
FROM [Increases6-18];

cboRating Rowsource
SELECT DISTINCT [Increases6-18].Rating FROM [Increases6-18] WHERE
[Increases6-18].Quartile=cboQuartile.Value ORDER BY [Increases6-18].Rating;

cboIncreasePercent – Rowsource
SELECT DISTINCT [Increases6-18].Increase_Percent FROM [Increases6-18] WHERE
((([Increases6-18].Rating)=cboRating.Value) AND
(([Increases6-18].Quartile)=cboQuartile.Value)) ORDER BY
[Increases6-18].Increase_Percent;
I've tried various combination in the AfterUpdate Event combo box, but it
still won't requery. Help. Thanks
--
tm


talibm said:
Ok, Doug I've reread the article and my form is not a continuous form. This
how I want to use the merit increase form I'm trying to create. The
supervisor selects one of the workers he/she supervises (Employees form).
From the merit increase subform the supervisor selects the quartile (1-4),
the rating (Competent, Distinguished, etc) and the increase percent. Then the
supervisor would go to the next employees and the merit increase form should
reset for the next employee's record. I hope that this helps explain what I'm
trying to accomplish.
--
tm


talibm said:
Sorry Doug I must have misunderstood what you meant about a continuous form.
I am obviously in over my head. I'll ake another look at the article. Thanks
--
tm


Douglas J. Steele said:
When I worked with you earlier, you said it wasn't a continuous form! What
you're describing is exactly how continuous forms work, and why I wrote the
article about how to solve the problem that you said you already downloaded.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Thanks Beetle for responding. When moving from one record to the next the
fields contain the same selections from the first record. When the form
opens
each field is blank and after I make the choices in the first record all
of
the records after that have the same fields selected. i know I'm in over
my
head, but this project was kind of thrust on me and I need all the help I
can
get. Thanks.

Talib
--
tm


:

Well, it seems like your over coding here. Your SQL statement "Select
Distinct......etc." should be contained in the row source of your como
box.
You shouldn't need to "rebuild" it everytime the After Update event runs.
Also, you are doing your requery multiple times on each field, which is
also
unnecessary. When you say it doesn't requery, which part doesn't requery?
You've got so many in your code it's a little hard to tell what you mean.

:

I have three combo boxes cboQuartile, cboRating, cboIncreasePercent.
The user
selects a quartile and then a rating and then an increase percent. This
part
works fine, but when I move to the next record it doesn't requery. I've
received lots of help getting this far and I need a little more to get
over
the hump. I in over my head and could use some help. Thanks in advance.
This
is what I have so far

Private Sub cboQuartile_AfterUpdate()
Me!cboRating = Null
Me!cboRating.Requery
On Error Resume Next
cboRating.RowSource = "Select Distinct [Increases6-18].Rating " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Quartile = " & cboQuartile.Value & " " & _
"Order By [Increases6-18].Rating;"
Me!cboRating.Requery
End Sub

Private Sub cboRating_AfterUpdate()
Me!cboIncreasePercent = Null
Me!cboIncreasePercent.Requery
On Error Resume Next
Me!cboIncreasePercent.RowSource = _
"Select Distinct [Increases6-18].Increase_Percent " & _
"From [Increases6-18] " & _
"WHERE [Increases6-18].Rating = '" & Me!cboRating & "' " & _
"AND [Increases6-18].Quartile = " & Me!cboQuartile & _
" Order By [Increases6-18].Increase_Percent;"

End Sub

Private Sub Form_Current()
cboQuartile.Requery
cboRating.Requery
cboIncreasePercent.Requery
 

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