Populate Fields on Form based on Dropdown selection in Form

G

Guest

Hi,

I am working with an Asset table/form. Since different assets have
different types of info we save I was wondering how to make the form adjust
the options once the type of asset has been selected. Example if asset
Vehicle is selected then thing like, VIN#, Make, Model, Starting Milieage,
Insurance Carrier, Driver etc. will appear on the form to be filled out. If
the asset is Computer then a different set of options would appear for them
to enter or select from.

Thanks,

ben
 
G

Guest

Hi Ben

The simple thing to do here (if you don't have too many types of assets)
would be to create a nice looking form each type. Then AfterUpdate of the
list the form for that asset would open.

Private Sub ListName_AfterUpdate()
If Me.ListName = "ABCD" Then
DoCmd.OpenForm "Form1", acNormal, "", "", , acNormal
End If
If Me.ListName = "EFGH" Then
DoCmd.OpenForm "Form2", acNormal, "", "", , acNormal
End If
End Sub


An other way would be to have all the controls on one form and make them
visible or not depending on what you select in the list.

Private Sub Form_Load()
Me.cbo123.Visible = False
Me.cbo456.Visible = False
Me.cbo789.Visible = False
Me.cbo101.Visible = False
End Sub



Private Sub Combo2_AfterUpdate()
If Me.Combo2 = "xyz" Then
Me.cbo123.Visible = True
Me.cbo456.Visible = True
End If
If Me.Combo2 = "abc" Then
Me.cbo789.Visible = True
Me.cbo101.Visible = True
End If
End Sub

This is just a quick answer (off for coffee now) but I hope it helps you in
the right direction.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top