Filtering combo based on previous combo

J

Jaime

I'm using Office 2007. I have done a similar operation in a previous version
of Access but for whatever reason this is not working in 2007.

I'm trying to filter the values in a combo based on selection of a previous
combo. The problem is that:
i) i'm unable to set the value to an empty string and so it will always keep
the last value visible
ii) the filter works the first time. However once I change the previous
combo value again ... the filtering does not work. It keeps the old value.
I actually have to use the "refresh all" button available in the menu.
Here's what I have done:

combo1 (name = ReleaseName) has 3 products (A, B, C)
combo2 (ReleaseVersion) should be filtered depending on what I choose as
release name:

In combo1, i've done the following:

I'm launching the "After Update" Event which looks like this:
Option Compare Database

Private Sub ReleaseName_AfterUpdate()
Me!ReleaseVersion.Value = ""
Me.ReleaseVersion.Requery

End Sub

Any help will be greatly appreciate.

btw ... the ReleaseVersion executes the query (row source):

SELECT Release.ReleaseVersion, Release.ReleaseName
FROM Release
WHERE (((Release.ReleaseName)=[Forms]![Product]![ReleaseName]));

~ Jaime"
 
D

Douglas J. Steele

What does "not working" mean? Are you getting an error? If so, what's the
error?

One thing, to deselect a combo box, you should use Null, not a zero-length
string:

Me!ReleaseVersion.Value = Null
 
J

Jaime

By not working I mean:

I) It applies the filter on once. For example, I select "Release" =
TestRelease and when I select the "ReleaseVersion" combo, it correctly
displays the filtered versions. However, If I go and change the releasename
again ... it does not perform the requery. Instead it shows the previous
value in the drop down

II) I cannot get the combo to "deselect". I've tried using "" and I also
tried using
Me!ReleaseVersion.Value = Null but the combo displays the last value.

Thanks for your prompt reply.

Douglas J. Steele said:
What does "not working" mean? Are you getting an error? If so, what's the
error?

One thing, to deselect a combo box, you should use Null, not a zero-length
string:

Me!ReleaseVersion.Value = Null

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jaime said:
I'm using Office 2007. I have done a similar operation in a previous
version
of Access but for whatever reason this is not working in 2007.

I'm trying to filter the values in a combo based on selection of a
previous
combo. The problem is that:
i) i'm unable to set the value to an empty string and so it will always
keep
the last value visible
ii) the filter works the first time. However once I change the previous
combo value again ... the filtering does not work. It keeps the old
value.
I actually have to use the "refresh all" button available in the menu.
Here's what I have done:

combo1 (name = ReleaseName) has 3 products (A, B, C)
combo2 (ReleaseVersion) should be filtered depending on what I choose as
release name:

In combo1, i've done the following:

I'm launching the "After Update" Event which looks like this:
Option Compare Database

Private Sub ReleaseName_AfterUpdate()
Me!ReleaseVersion.Value = ""
Me.ReleaseVersion.Requery

End Sub

Any help will be greatly appreciate.

btw ... the ReleaseVersion executes the query (row source):

SELECT Release.ReleaseVersion, Release.ReleaseName
FROM Release
WHERE (((Release.ReleaseName)=[Forms]![Product]![ReleaseName]));

~ Jaime"
 
D

Douglas J. Steele

Sorry, I can't think of any reason that should be happening.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jaime said:
By not working I mean:

I) It applies the filter on once. For example, I select "Release" =
TestRelease and when I select the "ReleaseVersion" combo, it correctly
displays the filtered versions. However, If I go and change the
releasename
again ... it does not perform the requery. Instead it shows the previous
value in the drop down

II) I cannot get the combo to "deselect". I've tried using "" and I also
tried using
Me!ReleaseVersion.Value = Null but the combo displays the last value.

Thanks for your prompt reply.

Douglas J. Steele said:
What does "not working" mean? Are you getting an error? If so, what's the
error?

One thing, to deselect a combo box, you should use Null, not a
zero-length
string:

Me!ReleaseVersion.Value = Null

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jaime said:
I'm using Office 2007. I have done a similar operation in a previous
version
of Access but for whatever reason this is not working in 2007.

I'm trying to filter the values in a combo based on selection of a
previous
combo. The problem is that:
i) i'm unable to set the value to an empty string and so it will always
keep
the last value visible
ii) the filter works the first time. However once I change the
previous
combo value again ... the filtering does not work. It keeps the old
value.
I actually have to use the "refresh all" button available in the menu.
Here's what I have done:

combo1 (name = ReleaseName) has 3 products (A, B, C)
combo2 (ReleaseVersion) should be filtered depending on what I choose
as
release name:

In combo1, i've done the following:

I'm launching the "After Update" Event which looks like this:
Option Compare Database

Private Sub ReleaseName_AfterUpdate()
Me!ReleaseVersion.Value = ""
Me.ReleaseVersion.Requery

End Sub

Any help will be greatly appreciate.

btw ... the ReleaseVersion executes the query (row source):

SELECT Release.ReleaseVersion, Release.ReleaseName
FROM Release
WHERE (((Release.ReleaseName)=[Forms]![Product]![ReleaseName]));

~ Jaime"
 

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