Limiting choices on forms

  • Thread starter Thread starter Patti
  • Start date Start date
P

Patti

Hi!

Is it possible to limit the choices in a form combo-box
based on the entry in the previous combo-box on the same
form? For example, if a user enters CA in a combo-box
labeled "States", can the available choices in
the "Cities" combo-box be limited to California cities?
I tried entering a query to do so in the Row Source
property, but it's not working.

Thanks
 
Hi Julie,

That's a great resource! Unfortunately, I can't get it to
work exactly the way I want it to -- I'm doing something
wrong!

I wasn't sure if the instructions were for one method or
two -- I tried entering everything but it didn't work.
When I try the last two separately (which is almost what I
had to begin with) -- the stored query and the requery, it
works but there is no data in the second combobox. If I
add the first instruction (setting the rowsourcetype to
field list and listing the table as the rowsource), it
works, but the drop down list shows the table fields, not
the data. I'm missing something!

Here's my data:

The first control is "location". The combobox has the
rowsourcetype of field list and the rowsource as the
table "Locations". This table has a field
called "location" which is what I want to pull. I added
the AfterUpdate event of:

Private Sub Location_AfterUpdate()
[Forms]![PO]![RFCE#].Requery
End Sub

The second control is "RFCE#". The combobox has the
rowsourcetype of Table/Query and the rowsource of:

SELECT RFCE.[RFCE#] FROM RFCE WHERE (((RFCE.Location)=
([Forms]![PO]![Location])));

With this, I can type in the location and get the correct
project number, but I can't get the drop down box to work
for Location (it works for RFCE#).

What am I doing wrong?

Thanks!
 
Hi Patti

does it work if you change the row source for location to table/query & use
the location field out of the Locations table?
e.g.
SELECT Locations.[Location] FROM Locations

Please let me know how you go

Cheers
JulieD

Patti said:
Hi Julie,

That's a great resource! Unfortunately, I can't get it to
work exactly the way I want it to -- I'm doing something
wrong!

I wasn't sure if the instructions were for one method or
two -- I tried entering everything but it didn't work.
When I try the last two separately (which is almost what I
had to begin with) -- the stored query and the requery, it
works but there is no data in the second combobox. If I
add the first instruction (setting the rowsourcetype to
field list and listing the table as the rowsource), it
works, but the drop down list shows the table fields, not
the data. I'm missing something!

Here's my data:

The first control is "location". The combobox has the
rowsourcetype of field list and the rowsource as the
table "Locations". This table has a field
called "location" which is what I want to pull. I added
the AfterUpdate event of:

Private Sub Location_AfterUpdate()
[Forms]![PO]![RFCE#].Requery
End Sub

The second control is "RFCE#". The combobox has the
rowsourcetype of Table/Query and the rowsource of:

SELECT RFCE.[RFCE#] FROM RFCE WHERE (((RFCE.Location)=
([Forms]![PO]![Location])));

With this, I can type in the location and get the correct
project number, but I can't get the drop down box to work
for Location (it works for RFCE#).

What am I doing wrong?

Thanks!
-----Original Message-----
hi Patti

Have you checked out:
http://www.mvps.org/access/forms/frm0028.htm

please let us know how you get on ...

Regards
JulieD




.
 
Thanks Julie! That did the trick. I thought I had tried
that at one point, but it didn't work. Works now! Thanks
again!
-----Original Message-----
Hi Patti

does it work if you change the row source for location to table/query & use
the location field out of the Locations table?
e.g.
SELECT Locations.[Location] FROM Locations

Please let me know how you go

Cheers
JulieD

Hi Julie,

That's a great resource! Unfortunately, I can't get it to
work exactly the way I want it to -- I'm doing something
wrong!

I wasn't sure if the instructions were for one method or
two -- I tried entering everything but it didn't work.
When I try the last two separately (which is almost what I
had to begin with) -- the stored query and the requery, it
works but there is no data in the second combobox. If I
add the first instruction (setting the rowsourcetype to
field list and listing the table as the rowsource), it
works, but the drop down list shows the table fields, not
the data. I'm missing something!

Here's my data:

The first control is "location". The combobox has the
rowsourcetype of field list and the rowsource as the
table "Locations". This table has a field
called "location" which is what I want to pull. I added
the AfterUpdate event of:

Private Sub Location_AfterUpdate()
[Forms]![PO]![RFCE#].Requery
End Sub

The second control is "RFCE#". The combobox has the
rowsourcetype of Table/Query and the rowsource of:

SELECT RFCE.[RFCE#] FROM RFCE WHERE (((RFCE.Location)=
([Forms]![PO]![Location])));

With this, I can type in the location and get the correct
project number, but I can't get the drop down box to work
for Location (it works for RFCE#).

What am I doing wrong?

Thanks!
-----Original Message-----
hi Patti

Have you checked out:
http://www.mvps.org/access/forms/frm0028.htm

please let us know how you get on ...

Regards
JulieD

Hi!

Is it possible to limit the choices in a form combo- box
based on the entry in the previous combo-box on the same
form? For example, if a user enters CA in a combo- box
labeled "States", can the available choices in
the "Cities" combo-box be limited to California cities?
I tried entering a query to do so in the Row Source
property, but it's not working.

Thanks


.


.
 
Hi Patti

glad to hear that it's solved - thanks for the feedback

Cheers
JulieD

Patti said:
Thanks Julie! That did the trick. I thought I had tried
that at one point, but it didn't work. Works now! Thanks
again!
-----Original Message-----
Hi Patti

does it work if you change the row source for location to table/query & use
the location field out of the Locations table?
e.g.
SELECT Locations.[Location] FROM Locations

Please let me know how you go

Cheers
JulieD

Hi Julie,

That's a great resource! Unfortunately, I can't get it to
work exactly the way I want it to -- I'm doing something
wrong!

I wasn't sure if the instructions were for one method or
two -- I tried entering everything but it didn't work.
When I try the last two separately (which is almost what I
had to begin with) -- the stored query and the requery, it
works but there is no data in the second combobox. If I
add the first instruction (setting the rowsourcetype to
field list and listing the table as the rowsource), it
works, but the drop down list shows the table fields, not
the data. I'm missing something!

Here's my data:

The first control is "location". The combobox has the
rowsourcetype of field list and the rowsource as the
table "Locations". This table has a field
called "location" which is what I want to pull. I added
the AfterUpdate event of:

Private Sub Location_AfterUpdate()
[Forms]![PO]![RFCE#].Requery
End Sub

The second control is "RFCE#". The combobox has the
rowsourcetype of Table/Query and the rowsource of:

SELECT RFCE.[RFCE#] FROM RFCE WHERE (((RFCE.Location)=
([Forms]![PO]![Location])));

With this, I can type in the location and get the correct
project number, but I can't get the drop down box to work
for Location (it works for RFCE#).

What am I doing wrong?

Thanks!

-----Original Message-----
hi Patti

Have you checked out:
http://www.mvps.org/access/forms/frm0028.htm

please let us know how you get on ...

Regards
JulieD

message
Hi!

Is it possible to limit the choices in a form combo- box
based on the entry in the previous combo-box on the same
form? For example, if a user enters CA in a combo- box
labeled "States", can the available choices in
the "Cities" combo-box be limited to California cities?
I tried entering a query to do so in the Row Source
property, but it's not working.

Thanks


.


.
 
Back
Top