469,917 Members | 1,474 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Multiple combo boxes on Continuous Form

I have a Continuous Form based on the following table:

sku, description, categoryId, subCategoryId

I restrict the initial dataset to include one value for categoryId, but
it may include differing valuse for subCategoryId. The user needs to
be able to modify either Category or SubCategory.

I have placed two combo boxes on the form, they are query based and
linked to the two Id columns. The cboCategory displays category names
and updates the categoryId column, and works fine. The cboSubCategory
is linked to subCategoryId, and also works fine.

The problem that I am having is purely in the way the form appears
after data values are changed.

When the category changes I redefine the query that cboSubCategory is
based on and refresh the control. This allows the user to pick the
appropriate value. I am also redefining this query and refreshing in
the Form_Current event.

The data is such that subCategoryId's are unique.

The problems that I am encountering are that when cboCategory is
changed, all rows of cboSubCategory are blanked. When selecting
cboCategory on another row, where all entries are of the initial value,
all the cboSubCategories are repopulated correctly.

I hope that's somewhat clear . . .

Here's the code from the form:

Private Sub cboCategory_Change()

CurrentDb.QueryDefs("qryGetSubCategoryByCategory") .SQL = "EXEC
getCategoryByCategory" & Me.categoryId

Me.cboSubCategory.Requery
End Sub

Private Sub Form_Current()

CurrentDb.QueryDefs("qryGetSubCategoryByCategory") .SQL = "EXEC
getCategoryByCategory" & Me.categoryId

Me.cboSubCategory.Requery
End Sub

Sure would appreciate any help.

Oct 4 '06 #1
2 2444
I have a Continuous Form based on the following table:
>
sku, description, categoryId, subCategoryId

I restrict the initial dataset to include one value for categoryId, but
it may include differing valuse for subCategoryId. The user needs to
be able to modify either Category or SubCategory.

I have placed two combo boxes on the form, they are query based and
linked to the two Id columns. The cboCategory displays category names
and updates the categoryId column, and works fine. The cboSubCategory
is linked to subCategoryId, and also works fine.

The problem that I am having is purely in the way the form appears
after data values are changed.

When the category changes I redefine the query that cboSubCategory is
based on and refresh the control. This allows the user to pick the
appropriate value. I am also redefining this query and refreshing in
the Form_Current event.

The data is such that subCategoryId's are unique.

The problems that I am encountering are that when cboCategory is
changed, all rows of cboSubCategory are blanked. When selecting
cboCategory on another row, where all entries are of the initial value,
all the cboSubCategories are repopulated correctly.

I hope that's somewhat clear . . .

Here's the code from the form:

Private Sub cboCategory_Change()

CurrentDb.QueryDefs("qryGetSubCategoryByCategory") .SQL = "EXEC
getCategoryByCategory" & Me.categoryId

Me.cboSubCategory.Requery
End Sub

Private Sub Form_Current()

CurrentDb.QueryDefs("qryGetSubCategoryByCategory") .SQL = "EXEC
getCategoryByCategory" & Me.categoryId

Me.cboSubCategory.Requery
End Sub

Sure would appreciate any help.
The article at the following link explains it quite well and describes
a workaround:

http://www.fmsinc.com/free/newtips/a...ccesstip16.asp

HTH,
Bruce

Oct 5 '06 #2
Thanks for the info. Their workaround is OK, just not what the user
asked for.

Looks like the choice of Access for this job was the wrong one.

Oct 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by dskillingstad | last post: by
1 post views Thread by dhowell | last post: by
8 posts views Thread by fonzie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.