BleepingComputer.com: Drop down menu's - Microsoft Access

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Drop down menu's - Microsoft Access Structuring and linking input menus

#1 User is offline   lizi 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 33
  • Joined: 31-March 07

Posted 30 December 2008 - 11:55 AM

I am currently building a database for my school project in Access.

I wanted to have a series of drop down menu's but before you can move onto the next drop down menu you must first fill in the first drop down menu, and your choice there will effect the options that you have in the second one.

I will try and explain in terms of my actual project...It is for a dance school's shop.... for example there are items such as Leotards and Shoes.
The leotards come in sizes such as 1A 1B 2A 2 B etc, whilst the shoes come in 3, 4, 5, 6, 7....
If the item 'leotard' was selected in the first drop down menu, then for the second drop down menu (about sizes) I dont want to have the shoe sizes there, just the leotard ones.

I hope someone understands :thumbsup: lol. How would I go about doing this?

I would appreciate any help, lizi x

(Moderator edit: added Topic Description. jgw)

This post has been edited by jgweed: 05 January 2009 - 10:25 AM


#2 User is offline   glnbnz 

  • New Member
  • Pip
  • Find Topics
  • Group: Members
  • Posts: 13
  • Joined: 13-October 08

Posted 09 January 2009 - 11:25 AM

If you can code in Visual Basic try going to this website: Martin Green's Access Tips

There are many categories but the Access and SQL Parts 1-5 will help you through what you are trying to accomplish.

If you get stuck just reply and I will try to help you through it.



***Edit: There is a category called Cascading Lists that should be of interest also :-)

This post has been edited by glnbnz: 09 January 2009 - 05:26 PM

Note to self
<Insert something clever here>

#3 User is offline   lizi 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 33
  • Joined: 31-March 07

Posted 18 January 2009 - 04:57 PM

Thank you :thumbsup:

I'll have a look at it sometime this week and get back to you if i need any help.

Thanks again, lizi

#4 User is offline   lizi 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 33
  • Joined: 31-March 07

Posted 21 January 2009 - 01:05 PM

Ok...so I went with the cascading list option and did Example 1: Multiple Row Source Tables.

I have made a 'Category' Field on a 'Product info' table, where there is a combo box that retrieves its data from a table called 'category' and this allows the user to pick from 'leotards, shoes, or tights'

On the 'product info' table there is also a 'Size' Field...I have made 3 separate tables, Leotardsizes, shoesizes and Tightsizes and within these there is a field called 'Sizes' and I want it so when they choose 'leotards, shoes or tights' from the 'categories' list, they will get the relevant list of sizes in the 'size' field on the product info table/form'

Im tried out this code by substituting my table and field names i'm assuming it will be right? but could you please check it :thumbsup:

Public Sub cascadingtest()
Select Case cboCategory.Value
Case "Leotards"
cboSizes.RowSource = "tblLeotardsizes"
Case "Shoes"
cboSizes.RowSource = "tblShoesizes"
Case "Tights"
cboSizes.RowSource = "tblTightsizes"
End Select
End Sub

The only thing is, is im not sure where to put this code, do i just enter it straight into VBA? or do i have to go through my tables to VBA...etc lol

Also, for the 'Size' part on the products field, in design mode....what do I put for 'Lookup'?

Thanks :flowers: x

This post has been edited by lizi: 21 January 2009 - 02:01 PM


#5 User is offline   glnbnz 

  • New Member
  • Pip
  • Find Topics
  • Group: Members
  • Posts: 13
  • Joined: 13-October 08

Posted 27 January 2009 - 04:57 PM

Okay the code you are referring to would go in the Form's VBA that has cboCategory. To do this open the form in design view, on the Database Toolbar there is a symbol for the Visual Basic code editor. Open the VBA code editor. In the box on the leftside of the editor, your form that has cboCategory should be highlighted. Now on the right part of the VBA code editor you will see 2 combo boxes. One that states (General) and one that states (Declarations).

Press the drop down in the combo box that states (General). In the list select cboCategory. After you have completed that press the drop down in the box that said (Declarations) (it will probably say BeforeUpdate now) scroll up and select AfterUpdate.

Your cursor should be in the middle and ready for code now and should look like this

Quote

Private Sub cboCategory_AfterUpdate(Cancel As Integer)

End Select
End Sub


Paste your code into there so that it looks like this:

Quote

Private Sub cboCategory_AfterUpdate(Cancel As Integer)
Select Case cboCategory.Value
Case "Leotards"
cboSizes.RowSource = "tblLeotardsizes"
Case "Shoes"
cboSizes.RowSource = "tblShoesizes"
Case "Tights"
cboSizes.RowSource = "tblTightsizes"
End Select
End Sub


I am not too sure about your "Lookup" question sorry.

I hope that this helps

This post has been edited by glnbnz: 27 January 2009 - 04:59 PM

Note to self
<Insert something clever here>

#6 User is offline   glnbnz 

  • New Member
  • Pip
  • Find Topics
  • Group: Members
  • Posts: 13
  • Joined: 13-October 08

Posted 27 January 2009 - 04:58 PM

Sorry pressed wrong button

This post has been edited by glnbnz: 27 January 2009 - 04:59 PM

Note to self
<Insert something clever here>

#7 User is offline   lizi 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 33
  • Joined: 31-March 07

Posted 20 February 2009 - 08:13 AM

Yay thank you for all your help :thumbsup:

Got it working yay!

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users