Solved

Access Question on Drop Down List in Access 2007

Posted on 2011-09-21
11
321 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 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) 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
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.

 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) 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
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
word 2016 1 29
Can not open the Access Help ? 3 52
Calculate workdays and consider holidays database from microsoft 2007 8 19
SQL Group on First occurrence 9 23
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

816 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

10 Experts available now in Live!

Get 1:1 Help Now