Auto populate a form (1 Viewer)

Jonathan Suthard

Registered User.
Local time
Yesterday, 22:31
Joined
May 17, 2018
Messages
12
What is the best/easiest way to populate a form with a list of names that all have the same field in their record...

I have a combo that reflects a field on a table. I need to populate a form with names based on this combo box selection.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 05:31
Joined
Feb 19, 2013
Messages
16,553
can you clarify your terminology - names of what?
 

Jonathan Suthard

Registered User.
Local time
Yesterday, 22:31
Joined
May 17, 2018
Messages
12
Names of students stored in a table that has a specific field common to them such as...1st period
 

CJ_London

Super Moderator
Staff member
Local time
Today, 05:31
Joined
Feb 19, 2013
Messages
16,553
still unclear, you seem to be saying

populate a form with a list of names that all have the same name in their record..

perhaps provide an example of the data and the outcome required - at the moment it sounds like your example data is

John Smith
Harry Smith
Henry James
Harry Smith

and what you want is

Harry Smith
 

nhorton79

Registered User.
Local time
Today, 18:31
Joined
Aug 17, 2015
Messages
147
Usually a form doesn’t display multiple records of the same type.

If you want to display all the records (names) of a particular type it is best IMHO to use a listbox. Or use a subform.


Nick
Sent from my iPhone using Tapatalk
 

Jonathan Suthard

Registered User.
Local time
Yesterday, 22:31
Joined
May 17, 2018
Messages
12
CJ,

I have a table with student names on it, this table contains several columns (fields) all with different data.

One of the columns contains the class period those students are in. I need to populate a form with all of the names from a specific class period.


ID Last First Class
123 Jones Sally 1st
112 Jones Bill 2nd
154 Koner Jayson 1st
145 Koner Jamie 2nd
157 Lavern Suzie 1st


I need to populate a form by selecting "1st" either from a combo box or a list box.

What I need is...
123 Jones Sally
154 Koner Jayson
157 Lavern Suzie

Hope this clarifies the situation
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:31
Joined
Feb 19, 2002
Messages
42,981
Create an unbound main form to hold the selection criteria and a bound subform in DS view to display the selection.

The RecordSource for the subform should be a query with a WHERE clause that references the combo on the main form.

Select ...
From ..
WHERE ClassID = Forms!yourformname!cboClassID

If there is only one criteria, then in the AfterUpdate event of the combo, requery the subform.

Me.Mysubformname.Requery

If there are multiple criteria, use a button to requery the subform.
 

Jonathan Suthard

Registered User.
Local time
Yesterday, 22:31
Joined
May 17, 2018
Messages
12
Pat,

Thank you very much! I knew it could be done just didn't know how to do it. Not sure my knowledge level in Access will make this easy or not...more than likely not. However, I am going to give it a shot today!!!


Thanks again!
 

Users who are viewing this thread

Top Bottom