Unbound Combo Box

M

Marlita

Hello.

I have a combo box ("CITYID") that lists all US cities from my tblCity. I
want to create an unbound combo box that would allow me to choose a state and
have my "CITYID" combo box only display cities from the selected state.

Please help.

Thank you
 
M

Marlita

Hi Ken. Thank you for you reply. However, I am a new user and it was a
little over my head. I read it several times and I tried to see if other
similar posts existed, but the ones that I found still were a little too
complex for me. Could you please explain it a little simpler.

Thank you! I'm learning steadily.

Marlita
 
J

john.mctigue

Hi Ken.  Thank you for you reply.  However, I am a new user and it was a
little over my head.  I read it several times and I tried to see if other
similar posts existed, but the ones that I found still were a little too
complex for me.  Could you please explain it a little simpler.

Thank you!  I'm learning steadily.  

Marlita






- Show quoted text -

Hello Marlita,

You might also look at Martin Green's tutorial on Cascading Lists for
Access Forms (http://www.fontstuff.com/access/acctut10.htm).

Kind regards,
John
 
L

Linq Adams via AccessMonster.com

Place a combobox on your form

When the Combobox Wizard comes up hit Cancel

With the combobox selected, goto Properties - Other

In the Name Property enter cboStates

Click on the Data Tab

In the Row Source Property enter

SELECT DISTINCT tblCity.StateFieldName FROM tblCity ORDER BY [StateFieldName]
;

Now go into he AfterUpdate event for your cboStates combobox and use this
code:

Private Sub cboStates_AfterUpdate()
CityID.RowSource = _
"Select Distinct tblCity.CityFieldName " & _
"FROM tblCity " & _
"WHERE tblCity.StateFieldName = '" & cboStates.Value & "' " & _
"ORDER BY tblCity.CityFieldName;"
cboCityID = ""
End Sub

Replace CityFieldName and StateFieldName with the actual names for these
fields from your table tblCity..
 
M

Marlita

Hi Linq. Thank you! This is so helpful.

John, if you read this, thank you too! That website was very helpful in
explaining how to do it myself later.

Marlita
 

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

Similar Threads


Top