473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamic creation of fields based on results of a query?

32
Hi group,

Is there an easy way to make a form create the same set of fields dynamically, once for each record returned by a query?

I have a query that's being called from a form and the results are displayed in a subform in datasheet view. This is nice, but I want a better (and more visually appealing) way to interact with the query results.

Instead of displaying the results in datasheet view, I'd like each field in each row to be displayed in the subform using text boxes and check boxes.

Because the query can return any number of records, I can't use a statically created form. A row of fields needs to be created once for each record returned by the query, and each of these rows needs to be placed one after the other on the form.

Is the only way to do this to use VBA to loop through the query results, create a row for the first record, then a new row X number of pixels below the previous row for each following record?

Thanks for any suggestions!

Oliver
Jan 9 '08 #1
8 7489
Minion
108 Expert 100+
I'm pretty sure there is a way to add elements to a form, but doing so (especially if there were a large number of records) would be very system intensive. Wouldn't it be better to create a seperate continuous form that will display the sub data in a manner you like and then use that form as the sub form for the main form? In the past I have had nice looking results this way that will produce text boxes, check boxes, etc.

Hope this helps.

- Minion -
Jan 9 '08 #2
ADezii
8,834 Expert 8TB
Hi group,

Is there an easy way to make a form create the same set of fields dynamically, once for each record returned by a query?

I have a query that's being called from a form and the results are displayed in a subform in datasheet view. This is nice, but I want a better (and more visually appealing) way to interact with the query results.

Instead of displaying the results in datasheet view, I'd like each field in each row to be displayed in the subform using text boxes and check boxes.

Because the query can return any number of records, I can't use a statically created form. A row of fields needs to be created once for each record returned by the query, and each of these rows needs to be placed one after the other on the form.

Is the only way to do this to use VBA to loop through the query results, create a row for the first record, then a new row X number of pixels below the previous row for each following record?

Thanks for any suggestions!

Oliver
Minion has the only 'practical' solution to your problem.
Jan 9 '08 #3
missinglinq
3,532 Expert 2GB
"Is there an easy way to make a form create the same set of fields dynamically, once for each record returned by a query?"

No! And there is absolutely no reason to dos so. What you have described is, as Minion suggested, a Continuous View Form! It's not the Continuous Form that the Forms Wizard will produce, which looks very much like a Datasheet Form, but the elements of a Continuous Form can be arranged in any manner that you like, just like a Single View Form. You can adjust the amount of space that lies between each record or even have the fields of a single record appear on multiple lines if you prefer.

Welcome to TheScripts!

Linq ;0)>
Jan 9 '08 #4
jaxjagfan
254 Expert 100+
Most forms (including your subform) have various views with datasheet (as you are currently doing), single, and continous as choices.

Back-up your database. Go into design view of the subform and switch the view to single (this is the best view when you want a professional look and feel to your application). This will automatically create textboxes for all of your fields. Change the controls to the desired type (Some controls are datatype specific). Save your work frequently and view it perioically to see how the users are going to see it.

As Minion stated continuous forms are not the recommended method of display - especially for large datasets.
Jan 9 '08 #5
missinglinq
3,532 Expert 2GB
jaxjagfan, please read threadsa little more carefully and in their entirety before posting responses!

Olivero's requirements:
A row of fields needs to be created once for each record returned by the query, and each of these rows needs to be placed one after the other on the form.
Obviously, using a Single View in the subform is not going to meet these requirement!

And Minion did not say:
As Minion stated continuous forms are not the recommended method of display - especially for large datasets.
What he did say was:
Wouldn't it be better to create a seperate continuous form that will display the sub data in a manner you like and then use that form as the sub form for the main form?
Linq
Jan 9 '08 #6
olivero
32
Thanks for the replies, I'll check out Continuous Forms and see if it will do what i need.

Cheers,
Oliver
Jan 9 '08 #7
olivero
32
Continuous Forms view is EXACTLY what I was looking for!

With a little tweaking and hiding of unwanted lines and borders, and after removing the ability to edit the fields, I'm perfectly happy!

Thanks again guys!

Oliver
Jan 10 '08 #8
Minion
108 Expert 100+
Continuous Forms view is EXACTLY what I was looking for!

With a little tweaking and hiding of unwanted lines and borders, and after removing the ability to edit the fields, I'm perfectly happy!

Thanks again guys!

Oliver
I'm glad it worked out for you Oliver. Sometimes all we need is a bump in the right direction.

- Minion -
Jan 10 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
0
by: CSDunn | last post by:
Hello, I have a format issue on an Access 2000 ADP report that I am going to attempt to explain from a 'ten thousand foot view' : I have an Access 2000 ADP report that has a SQL Server 2000...
1
by: Richard Hollenbeck | last post by:
Hello Newsgroup. You have all been very helpful in the past and I thank you. I try to ask relevant questions so that they don't just benefit me, but also benefit the group. I'm currently...
2
by: Dave Williamson | last post by:
When a ASPX page is created with dynamic controls based on what the user is doing the programmer must recreate the dynamic controls again on PostBack in the Page_Load so that it's events are wired...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
13
by: salad | last post by:
Operating in A97. I didn't receive much of a response conserning Pivot tables in Access. Pivot tables are nice, but a CrossTab will work for me too. Using a Pivot table, one is actually...
6
by: RoomfulExpress | last post by:
Here's the problem that I'm having- I'm trying to pull in 2 fields from my database and place them in the title of the HTML. I'm connecting to the db and selecting everything exactly the same as I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.