Solved

Access Question on Drop Down List in Access 2007

Posted on 2011-09-21
11
320 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
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 3

Accepted Solution

by:
bigjdve earned 125 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 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 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 125 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
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
ID: 36576582
good..
0
 

Author Closing Comment

by:jjc9809
ID: 36576583
Thanks Everyone!

jjc9809
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

930 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now