Form Controls - dynamically creating (1 Viewer)

Ginny2222

Ginny
Local time
Today, 23:47
Joined
Oct 27, 2007
Messages
108
Hi all,
I have a form which I want to contain a list of people's names and for each person there are a set of textboxes which link to a querys in the background to show a drop down list.

On form load a query triggers to give me the current list of people and only that number of controls appears on the form. This is currently controlled through the textbox .visible = true property.

This is a very tedious method, and it would be limited to the number that I create on the form. I can't tell how many people are going to be returned on the query!

Is there a way I can create an array of textboxes on the fly and be able to reference them?

I hope I am explaining this properly :)

Help appreciated.

Ginny
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:47
Joined
Aug 30, 2003
Messages
36,129
Are you saying the people are returned as fields (columns) as opposed to records (rows)? Normally they would be records, and you would use a form in continuous or datasheet view to view them. It would show however many were returned without manipulation.
 

Ginny2222

Ginny
Local time
Today, 23:47
Joined
Oct 27, 2007
Messages
108
Hi Paul,
Thanks for replying to me. I have a query which returns the current set of people (records). The query will give different results each week. This set of records populates a set of textboxes on my form. The way I have it set up is that by a count of the people query makes the requisite number of textboxes visible. On the form I then need to create or make visible a set of controls (textboxes, labels, combo boxes) which are grouped with each person textbox. These also become visible for the right number of people.

I wanted to know if there is a better way of doing this, as it is very tedious to set up. Also, in this current way, if the query returns more people than I have allowed for on the form I'm in trouble!! I have the form set to continuous.

rgs
Ginny
 

Ginny2222

Ginny
Local time
Today, 23:47
Joined
Oct 27, 2007
Messages
108
Btw the reason I am trying to achieve this is that I need to show all people on the form at the same time. I can create a form with a subform for the extra fields, but once there is a subform I can't have a continuous form!
Ginny
 

Ginny2222

Ginny
Local time
Today, 23:47
Joined
Oct 27, 2007
Messages
108
Paul, I left out one vital piece of information. While the names of the people will be drawn from the query and will not be subject to change, the associated textboxes or fields will be input fields. I think that's where my main problem lies.
rgs
Ginny
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:47
Joined
Aug 30, 2003
Messages
36,129
Can you post the db, or at least a picture or something? I'm not visualizing what you're trying to do.
 

Ginny2222

Ginny
Local time
Today, 23:47
Joined
Oct 27, 2007
Messages
108
Here's a picture of 2 forms, both take input. They are based on a query and a table with a unique number identifying the person. The set of people change over time, so I need to run the query to identify them for the form. The table of days and type of attendance stay as is for data input, and that table takes the input. I have designed the input form in 2 ways which work. The first is tedious to build and has the disadvantage that I have set up a certain number of input rows - 30 on a continuous form and if the query were to pull back more than 30 names the form would not be able to handle it. The second form works for data input, but can't show the data on a continuous form. I haven't been able to find another way to design the form and be able to input data to the table.
rgs
Ginny
 

Attachments

  • Attendances.JPG
    Attendances.JPG
    87.6 KB · Views: 289

Users who are viewing this thread

Top Bottom