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

x
?
Solved

VB code for Data Population & Creating Cascade Combo Boxes

Posted on 2013-06-25
5
Medium Priority
?
397 Views
Last Modified: 2013-07-15
Data Entry FormQueryComboBox Data PropertiesComboBox EventPropertiesI have a data entry form in ACCESS program (someone else created) and I can't find VB code that populates the first name in the first name field when last name in the last name/first name drop down/combo box is selected.

Ultimately I need  to create two drop down boxes - (1) last name only and (2) once the user selects the last name and taps over to first name combo box, it will display first names only with the last name selected in the last name combo box.

But I can't even figure out where to find VB code on the current form where the first name is automatically populated once the last name is selected.
0
Comment
Question by:sglee
[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
  • 2
  • 2
5 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 39276383
You can use the AfterUPdate event of the first combo:

Sub YourFirstCombo After_UPdate()
  Me.YourSecondCombo.RowSource = "SELECT Emp_ID, First_Name FROM Emploee WHERE Last_Name='" & Me.YourFirstCombo.Column(1) & "'"
End Sub

I'm not sure of the actual Column to reference in YourFirstCombo ... the code above refers to the 2nd combo. If you need to refer to the 3rd column, use Me.YourFirstCombo.Column(2)
0
 
LVL 31

Assisted Solution

by:hnasr
hnasr earned 1000 total points
ID: 39276399
LastNameCombo row source: Select LastName from table1
FirstNameCombo row source: Select FirstName from table1 where LastName = LastNameCombo

LastNameCombo AfterUpdate event: FirstNameCombo Requery
0
 
LVL 31

Assisted Solution

by:hnasr
hnasr earned 1000 total points
ID: 39276452
I gave the idea,  LSMConsulting included the proper quoting
0
 

Author Comment

by:sglee
ID: 39276539
Thanks for the combo box suggestions above.

Can you see where I might be able to find the VB code that populates first name into the first name field (at this point, first name field is NOT a combo box. It is just text field)
0
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 39277526
I'm not sure what you're asking. The FirstName field could be "bound" to a control, or it could be filled through code action somewhere. The images you've given us aren't sufficient for us to tell this, and since we have no idea how the form is used it's impossible for us to say.

You could perhaps upload a copy of your database with specific instructions on how to recreate the issue. If you do this, be sure to remove any sensitive information first.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 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