Combo Box Troubles (1 Viewer)

camerontaylor

New member
Local time
Today, 11:49
Joined
May 11, 2021
Messages
29
Hi, I'm having some troubles with a combo box on a form. I want to be able to select an employee from the combo box list, and then open a new form which will display all projects which this employee is associated with (I have a table which keeps track of projects and lead employee on the project). I have the form set up, but the combo box is being strange.

I have the control source set to the ProjectLead field in my ProjectList table (this is a categories field, with a list of current employees). The row source type is set to value list, and the row source has a list of "Employee 1";"Employee 2"; etc. However, when I open the form in form view, the combo box only displays three of six employees in the list.

As well, I cannot work out how to get the button to open the form based on what combo box selection is made. I'd like to also be able to check that there is a selection made in the combo box, and throw a MsgBox if there isn't.

Any help is greatly appreciated!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 11:49
Joined
Aug 30, 2003
Messages
36,125
Oh, and you can test the combo:

INI:
If Len(Me.ComboName & vbNullString) > 0 Then
  DoCmd...
Else
  MsgBox...
End If
 

camerontaylor

New member
Local time
Today, 11:49
Joined
May 11, 2021
Messages
29
Great, thanks for your response @pbaldy ! Do you have any ideas about what's happening when my combo box is missing options that it should have? I have 6 different employees listed in the Row Source section of properties, but it only shows employee 2, 4, and 6. Does it need a control source? Does it not need one?
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:49
Joined
Sep 21, 2011
Messages
14,295
What happens when a new employee joins?
I'd take that data from employee table where employee is employed?
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:49
Joined
Sep 21, 2011
Messages
14,295
Great, thanks for your response @pbaldy ! Do you have any ideas about what's happening when my combo box is missing options that it should have? I have 6 different employees listed in the Row Source section of properties, but it only shows employee 2, 4, and 6. Does it need a control source? Does it not need one?
Do you have two columns in the combo?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 11:49
Joined
Aug 30, 2003
Messages
36,125
I'll get out of the way.
 

camerontaylor

New member
Local time
Today, 11:49
Joined
May 11, 2021
Messages
29
What happens when a new employee joins?
I'd take that data from employee table where employee is employed?
I was thinking that whoever is in charge of the database would be able to add a new category to the ProjectLead field, but this possibly wouldn't work as I think it might.
 

camerontaylor

New member
Local time
Today, 11:49
Joined
May 11, 2021
Messages
29
Do you have two columns in the combo?
Just one as far as I'm aware

EDIT: I just found that I did have 2, I changed it to 1, and now I get a longer drop down menu from the combobox, but it is completely blank. Almost like the entries are there but displayed in white text or something. This isn't the case, because if it were then I think I would still get a highlight on each entry in the list, but I don't.
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 19:49
Joined
Sep 21, 2011
Messages
14,295
Seems I should not have responded, sorry.
 

camerontaylor

New member
Local time
Today, 11:49
Joined
May 11, 2021
Messages
29
Apologies if I am asking too much, or am asking silly questions. I am just very much new to the Access scene. I was not looking to take up more of anybody's time than they were willing to give, and by no means looking to upset anyone. So, once again, my apologies if I have asked too much, or have asked silly questions. Just trying to find some answers to the problems I am experiencing.
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:49
Joined
Sep 21, 2011
Messages
14,295
Nothing to do with you. My mistake.😔
You will also get better help from pbaldy.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:49
Joined
Feb 19, 2002
Messages
43,274
There is most likely a typo in the value list.

I too would use a table. Make a table and a form to add entries, you probably don't want to delete entries but you should be able to mark them as inactive. Then the Combo will change to selecting from a query and the query can sort the Active employees to the top of the list. You can add code to the BeforeUpdate event of the combo to disallow selecting an inactive employee.
 

Users who are viewing this thread

Top Bottom