Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 30th, 2005, 08:36 PM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create Dynamic Form; end-user adds/drops columns

In forms I've customized for clients in the past, I've always placed each static field label in the form's header with corresponding variable table data in the form's detail. A current client wants to be able to add and delete columns, at will from a form she uses, via a GUI interface provided by MS Access. Can someone advise on how to design a form to be dynamic such that the end-user may pull into the form only the columns they need, or add new columns to an existing form, or drop unnecessary columns with columns maintaining headers?

If you have done this in the past, would you be willing to attach or email me a sample Access Database or sample code? I am experienced with MS Access but somewhat of a novice with modules/vba code but very willing to learn what is needed to solve this matter!
Reply With Quote
  #2 (permalink)  
Old May 1st, 2005, 01:18 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

The simplest way to accomplish this is to display the form in DataSheet view. Then teach your users how to use Access functionality.

E.g. Right click on a column heading and select "Hide Columns" to hide the column.

E.g. Right click on the form's caption and select "Unhide Columns..." to see a list of available columns to unhide.

Of course they can drag columns to reorder them and use "Freeze Columns" to keep them visible during right horizontal scroll.

No coding necessary!

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org
Reply With Quote
  #3 (permalink)  
Old May 1st, 2005, 03:03 PM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Randall, Thank you for this solution and at one point I had been thinking along those lines; however, this dynamic form will also have a subform in it which must be viewed in form view rather than datasheet view. From my understanding, there is no way to have the main form show in datasheet view and subform show in form view. Is that correct?
Reply With Quote
  #4 (permalink)  
Old May 1st, 2005, 09:27 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

You are correct... HOWEVER...

You could create a Master form. Then put the DataSheet view form and the single record form as subforms on that master.

Assuming that you want the single record form to display data from the selected record in the DataSheet view form, the trick then is how to link the item selected in the DataSheet form with the data in the single record form.

Actually, that's quite easy. In the OnCurrent event of the datasheet view, post the ID of the current record to a hidden text form on the master form. E.g.

Me.Parent.Form.txtHiddenID = Me.IDField

Then you Link the single record subform with that text field. NOTE: You can't use the wizard to set the Master and Child Link fields. You can type them in yourself.
Reply With Quote
  #5 (permalink)  
Old May 3rd, 2005, 11:56 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To rjweers aka Randall: After spending an entire weekend trying to find a solution to this problem, with very complex advice from many experienced programmers, I think you solved it for me :) with a simple, no-nonsense approach! I am so very grateful for the posts you provided that ultimately helped me to resolve this issue. Many thanks! :D You are awesome!!
Reply With Quote
  #6 (permalink)  
Old May 6th, 2005, 07:13 AM
Friend of Wrox
 
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

Just call me "simple" :D

Happy to be of service.
Reply With Quote
  #7 (permalink)  
Old February 15th, 2006, 03:32 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by rjweers
 You are correct... HOWEVER...

You could create a Master form. Then put the DataSheet view form and the single record form as subforms on that master.

Assuming that you want the single record form to display data from the selected record in the DataSheet view form, the trick then is how to link the item selected in the DataSheet form with the data in the single record form.

Actually, that's quite easy. In the OnCurrent event of the datasheet view, post the ID of the current record to a hidden text form on the master form. E.g.

Me.Parent.Form.txtHiddenID = Me.IDField

Then you Link the single record subform with that text field. NOTE: You can't use the wizard to set the Master and Child Link fields. You can type them in yourself.
Hi I am trying to create a form (tabular) and a subform (datasheet) that works in the reverse order, whereby upon choosing the Student Name, it will display the subjects taken by the students, the lecturer teaching the subject and the grades of the subjects in the subform. Upon selecting one of the subjects it will be able to display the corresponding information in the form's textboxes for editing. Is this feasible. Can anyone kindly please advise how I can link the subforms back to the form i.e. when I select one entry in the datasheet of the subform, it will be display in the form for editing purposes? Thanks alot.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create User Search Form JezLisle Access 1 November 6th, 2008 11:22 AM
Dynamic Columns & Dynamic Grouping ??? nileshgambhava BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 1 March 24th, 2008 07:58 AM
Create Dynamic User Control Prabhakar_dt ASP.NET 2.0 Professional 1 June 6th, 2007 07:30 AM
Oracle Back End - MS Access Front End - Multi User ckaliveas Oracle 1 February 1st, 2007 06:00 AM
Dynamic Columns & Dynamic Grouping ??? nileshgambhava SQL Server 2005 0 December 12th, 2006 12:45 AM



All times are GMT -4. The time now is 05:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.