Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access Question on Drop Down List in Access 2007

Posted on 2011-09-21
11
Medium Priority
?
327 Views
Last Modified: 2012-05-12
Hello Everyone,

I have a Drop Down List in my Access 2007 application that has a drop down List for Vehicle Type with this listing:

Vehicle Types
•      Motorcycle
•      Three-Wheeler
•      Car
•      Van
•      Pickup
•      SUV
•      Motor Home
•      Boat
•      Personal Water Craft
•      Truck
•      Trailer
•      Truck & Trailer
•      Self-propelled Campers
•      Other-specify


If the Boat is selected in the Drop Down, I want another Drop Down List to show for Boat with these fields:

Fields for Boats
•      Boat Year
•      Boat Make
•      Boat Hull Serial
•      Boat Reg Number
•      Boat Decal
•      Boat Length


My question, is there a way in Access 2007 to hide the Boat Field Drop Down until actually needed.  The Boat Field listing would only show if the Boat is selected as a drop down choice somehow.

In VB I can do this with logic by using an IF Statement or Case Statement.  

If  the Boat Field is selected in the Vehicle Type  Dropdown, make the Boat Field Visible, otherwise keep invisiblew inless needed.


jjc9809
0
Comment
Question by:jjc9809
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 3

Accepted Solution

by:
bigjdve earned 500 total points
ID: 36574775
I would use the visible attribute on the 2nd Drop Down List (Combo-Box). You can then build the if statement in the VB for the event.

Something to the effect of

If record.field = boat

then

combobox2.visible = yes (true)

Let me know if  this helps. I have done this in the past and it worked.Remember in Access you can always use VB for anything.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1000 total points
ID: 36574789
you can still use the select or If then statement in the afterupdate event of the first combo

private sub cboVehicleType_afterupdate()

if me.cboVehicleType="Boats" then
   me.cboBoat.visible=true
   me.cboBoat.RowSource= < select statement here >

end if


end sub
0
 
LVL 19

Assisted Solution

by:MINDSUPERB
MINDSUPERB earned 500 total points
ID: 36574798
You need to set the Visible property of your cboBoat into No. Then, you may try this code:

Private Sub cboBoat_AfterUpdate()
If Me.cboVehicles = "Boat" Then
Me.cboBoat.Visible = True
Else
Me.cboBoat.Visible = False
End If
End Sub


Sincerely,
Ed
0
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1000 total points
ID: 36574802
you can still use the select or If then statement in the afterupdate event of the first combo

private sub cboVehicleType_afterupdate()

if me.cboVehicleType="Boats" then
   me.cboBoat.visible=true
   me.cboBoat.RowSource= < select statement here >

  else

  me.cboBoat.visible=false
end if


end sub
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 36574803
Sorry Cap.

Ed
0
 

Author Comment

by:jjc9809
ID: 36576175
Hi Everyone,

I can't get this to work.  My Table is called Vehicles_tbl.  I have the VehicleType_vch in the table as well as BoatYear which is a comboBox field.  I am trying just top get
one of the field visible and not visible based on the If StateMent Logic.

My Field on the Vehicle Data Entry Form is VehicleType_Vch.  I have right clicked the VehicleType_vch field and on the After Update event I have placed the code:

If VehicleType_Vch = "Boat" Then
BoatYear.Visible = True
Else
Boat Year.Visible = False

This is just simple logic.  What I am doing wrong here?

The computer should know what BoatYear is since I have placed the correct name of it in the Vehicles Table that the form was created from.



Are you sure the After Update event is used and not the Before Update event or On Focus Update Event?

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36576214
you have to use the afterupdate event of the combo for vehicle type..

what is the name of the combo for vehicleType_vch?

what is the name of the combo for BoatYear ?


can you upload a copy of the db..
0
 

Author Comment

by:jjc9809
ID: 36576389
The name of the Combo for VehicleType_vch is "VehicleType_vch"
The Name of the Combo for BoatYear is "BoatYear"

jjc9809
0
 

Author Comment

by:jjc9809
ID: 36576565
Hi Everyone,

I got it to work.  I was using an incorrect name for the Combo Box.

jjc9809
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36576582
good..
0
 

Author Closing Comment

by:jjc9809
ID: 36576583
Thanks Everyone!

jjc9809
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question