dropdown menu in subforms (1 Viewer)

MK1999

New member
Local time
Today, 15:15
Joined
Mar 30, 2022
Messages
24
I have a subform where the user can insert trainer name and information (that related to a program) i want a way that the user know the trainer name already exists in the database so we willl not have a duplicated name.. for example dropdown menu in trainer name where the user can see the names or he can enter new name.
 

June7

AWF VIP
Local time
Today, 04:15
Joined
Mar 9, 2014
Messages
5,466
That is a combobox. Use a Row Source like:

SELECT TrainerID, LastName & ", " & FirstName AS FullName FROM Trainers;

As user types last name, the combobox will find match(es) and show in box, if any. If you want the dropdown to show, will need VBA to trigger or user must click on down arrow.

If you want to allow entry of new name into Trainers, use combobox NotInList event to allow adding 'on the fly' during data entry. https://blueclawdatabase.com/notinlist-event-code/
 

MK1999

New member
Local time
Today, 15:15
Joined
Mar 30, 2022
Messages
24
thank you.. now i have a combobox.. but to clarify this.. when i insert the name its create a new record. The point is i dont want to duplicate the trainer name if it is already exists in the database.. because after i i will create a page when the user click on the trainer name it will show all the previous programs he worked on..

so i dont know how i can insert the new information to the trainer record ( i have a composite table between program and trainer)

also i dont think combobox will be useful if i have 100+ names

any ideas?
 

June7

AWF VIP
Local time
Today, 04:15
Joined
Mar 9, 2014
Messages
5,466
I use combobox with 100's of items listed.

By "composite table" you mean a query?

If you want to create a new program record and select a trainer, bind form to program table only.
 

MK1999

New member
Local time
Today, 15:15
Joined
Mar 30, 2022
Messages
24
but how it will go the same trainer record by id for example? because if insert a name even from a combo box it create new trainer with new id.. it will be hard to retrieve trainer information.. here is the relationship
1650482159941.png
 

June7

AWF VIP
Local time
Today, 04:15
Joined
Mar 9, 2014
Messages
5,466
Form options for data entry:

1. Form bound to Trainer, subform bound to Program_trainer with a combobox to select program
2. Form bound to Program, subform bound to Program_trainer with a combobox to select trainer
3. Form bound to Program_trainer and comboboxes to select program and trainer
 
Last edited:

Cronk

Registered User.
Local time
Today, 22:15
Joined
Jul 4, 2013
Messages
2,771
I think 2 should be
2. Form bound to Program, subform bound to Program_trainer with a combobox to select trainer
 

jdraw

Super Moderator
Staff member
Local time
Today, 08:15
Joined
Jan 23, 2006
Messages
15,379
MK999,

Just curious. What is the source/program used for the data model/graphic?
 

Cronk

Registered User.
Local time
Today, 22:15
Joined
Jul 4, 2013
Messages
2,771
Too easy to slip on that sort of thing. Me too. Important thing is that the information is right.
 

jdraw

Super Moderator
Staff member
Local time
Today, 08:15
Joined
Jan 23, 2006
Messages
15,379
MK999,

Just curious. What is the source/program used for the data model/graphic?
 

Users who are viewing this thread

Top Bottom