A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Linking drop down boxes



 
 
Thread Tools Display Modes
  #1  
Old January 24th, 2010, 05:05 AM posted to microsoft.public.access.forms
SeanPT
external usenet poster
 
Posts: 3
Default Linking drop down boxes

I have a simple data entry form that has a drop down box that queries the
store numbers from a table. However, no one ever remembers the store numbers,
just the store names (east, west, etc.)

I'm trying to figure out how to do a text box that auto populates based on
what is in the drop down box. For example, if they choose "West" in the drop
down box, it auto populates the store # 1.

(The store information table has the Store #s as the PK along with the store
names so I have a table I can query)

This seems like something that should be easy but I'm banging my head on the
wall here. Thank you!
  #2  
Old January 24th, 2010, 05:50 AM posted to microsoft.public.access.forms
SeanPT
external usenet poster
 
Posts: 3
Default Linking drop down boxes

So aparently this is known as cascading lists and is apparently a very
popular question.

My table is dbo_ViewStoreInfo
My Store Number combo box is StoreNumber
My Store Name combo box is StoreName

So using the code examples I could find I came up with this, but it isn't
working...

Private Sub StoreName_AfterUpdate()
On Error Resume Next
cboStoreNumber.RowSource = "SELECT dbo_ViewStoreInfo.StoreNum " & _
"FROM dbo_ViewStoreInfo " & _
"WHERE dbo_ViewStoreInfo = '" & cboStoreName.Value & "' " & _
"ORDER BY dbo_ViewStoreInfo.StoreNum;"
End Sub

But that doesn't populate anything in the cboStoreNumber

"SeanPT" wrote:

I have a simple data entry form that has a drop down box that queries the
store numbers from a table. However, no one ever remembers the store numbers,
just the store names (east, west, etc.)

I'm trying to figure out how to do a text box that auto populates based on
what is in the drop down box. For example, if they choose "West" in the drop
down box, it auto populates the store # 1.

(The store information table has the Store #s as the PK along with the store
names so I have a table I can query)

This seems like something that should be easy but I'm banging my head on the
wall here. Thank you!

  #3  
Old January 24th, 2010, 06:13 AM posted to microsoft.public.access.forms
SeanPT
external usenet poster
 
Posts: 3
Default Linking drop down boxes

The example code didn't clarify that the "cbo" part isn't some specific call
to a combo box. Removing the cbo took care of it!

"SeanPT" wrote:

So aparently this is known as cascading lists and is apparently a very
popular question.

My table is dbo_ViewStoreInfo
My Store Number combo box is StoreNumber
My Store Name combo box is StoreName

So using the code examples I could find I came up with this, but it isn't
working...

Private Sub StoreName_AfterUpdate()
On Error Resume Next
cboStoreNumber.RowSource = "SELECT dbo_ViewStoreInfo.StoreNum " & _
"FROM dbo_ViewStoreInfo " & _
"WHERE dbo_ViewStoreInfo = '" & cboStoreName.Value & "' " & _
"ORDER BY dbo_ViewStoreInfo.StoreNum;"
End Sub

But that doesn't populate anything in the cboStoreNumber

"SeanPT" wrote:

I have a simple data entry form that has a drop down box that queries the
store numbers from a table. However, no one ever remembers the store numbers,
just the store names (east, west, etc.)

I'm trying to figure out how to do a text box that auto populates based on
what is in the drop down box. For example, if they choose "West" in the drop
down box, it auto populates the store # 1.

(The store information table has the Store #s as the PK along with the store
names so I have a table I can query)

This seems like something that should be easy but I'm banging my head on the
wall here. Thank you!

  #4  
Old January 24th, 2010, 03:08 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 1,555
Default Linking drop down boxes

Sean

"cbo" is a prefix commonly-used to indicate that the object is a combobox.
Using it and prefixes for other objects is part of a consistent naming
convention ... and having a consistent naming convention means that the next
person who has to understand/maintain your application (or you, if you walk
away for 6 months!) will have a better idea of what the pieces are and how
they work.

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.


"SeanPT" wrote in message
...
The example code didn't clarify that the "cbo" part isn't some specific
call
to a combo box. Removing the cbo took care of it!

"SeanPT" wrote:

So aparently this is known as cascading lists and is apparently a very
popular question.

My table is dbo_ViewStoreInfo
My Store Number combo box is StoreNumber
My Store Name combo box is StoreName

So using the code examples I could find I came up with this, but it isn't
working...

Private Sub StoreName_AfterUpdate()
On Error Resume Next
cboStoreNumber.RowSource = "SELECT dbo_ViewStoreInfo.StoreNum " & _
"FROM dbo_ViewStoreInfo " & _
"WHERE dbo_ViewStoreInfo = '" & cboStoreName.Value & "' " & _
"ORDER BY dbo_ViewStoreInfo.StoreNum;"
End Sub

But that doesn't populate anything in the cboStoreNumber

"SeanPT" wrote:

I have a simple data entry form that has a drop down box that queries
the
store numbers from a table. However, no one ever remembers the store
numbers,
just the store names (east, west, etc.)

I'm trying to figure out how to do a text box that auto populates based
on
what is in the drop down box. For example, if they choose "West" in the
drop
down box, it auto populates the store # 1.

(The store information table has the Store #s as the PK along with the
store
names so I have a table I can query)

This seems like something that should be easy but I'm banging my head
on the
wall here. Thank you!



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:56 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.