Link to home
Start Free TrialLog in
Avatar of bchadez
bchadez

asked on

Combo Box Row Source

I have a form with two combo boxes.  The first combo box is Employee Last Name which gets its row source from the query MasterEmployeeLastName which queries all the last names from the LastName field of the Master Employee List table.  Up to this point everything is working.  However, I need help with the second combo box.  The second combo box is Employee First Name which I would like its list to be the available first names from the Master Employee List table which have the last name chosen in the first combo box.
Avatar of wiswalld
wiswalld
Flag of United States of America image

SELECT DISTINCT Table2.Subcategory FROM Table2 WHERE (((Table2.Category)=[Forms]![Form2]![category]));

And this in the after update of the first combo box:

Me!Subcategory=Null
Me!Subcategory.Requery
ASKER CERTIFIED SOLUTION
Avatar of wiswalld
wiswalld
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you have not gotten to far into designing your database try to avoid using spaces in names of forms, tables, fields, etc.
Avatar of bchadez
bchadez

ASKER

I'm getting this error message after I entered the following in the after event box of the first combo.  Any ideas?

Microsoft Office Access can't find the object Me!Subcategory=Null
Me!Subcategory.Requery

error.jpg
Avatar of bchadez

ASKER

I also noticed you took out the spaces in the table names in the following code:

SELECT DISTINCT MasterEmployeeList.FirstName FROM MasterEmployeeList WHERE (((MasterEmployeeList.LastName)=[Forms]![Formname]![LastName]));

Unfortunately this table is in another database that has been in production for some time.  Is it possible to use spaces in the table names for this expression by surrounding it by quotes or something?
Avatar of bchadez

ASKER

Ok, I figured out the after update.  I created an event procudure with the following code.

Private Sub EMPLOYEELNAME_AfterUpdate()
Fname = Null
Fname.Requery
End Sub

And it looks like I can use spaces in my table name if I place it in brackets.

Thanks for the help!
I'm glad you got it. I left work for the day and just read your comments.