Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 1st, 2005, 02:40 PM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Refresh datasheet-view subform’s column headings f

In my parent form, I have two child subforms as follows: 1 is the subform employee header; it defaults to single form view. The second is the subform hours; it defaults to datasheet view and contains hours-worked detail. One of the benefits of using datasheet view is that the user can use built-in Access functionality to hide/unhide columns at will. I thought that the second benefit would be: when the dynamic query (qryHeadings) linked to the datasheet subform changes to include new column headings/columns, then those new column headings/columns would refresh the linked subform datasheet the next time that subform was opened.

However, my tests of this theory are showing that only the fields present in qryHeadings when it was first linked to the datasheet subform display in that subform, even after qryHeadings shows new column headings and datasheet subform is thereafter opened.

Please help me determine the flaw in my design.
  #2 (permalink)  
Old June 1st, 2005, 02:49 PM
ru1 ru1 is offline
Authorized User
 
Join Date: Feb 2005
Location: Detroit, MI, USA.
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Requery the subforms when the parent form is changed. You can do this in the afterupdate eventprocedure of the parent form. The same goes in any of the subform: me.frmName.requery.

Let me know if this works for you.

RU1

  #3 (permalink)  
Old June 1st, 2005, 04:27 PM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi RU1, Thanks for your response! Just to clarify, the parent form does not change; it acts merely as a way to link the two subforms together via an employeeID field. The change should occur in the datasheet subform only (as the second subform only provides reference information); specifically, after the qryHeading is updated with new column headings (and the number of columns may increase from the previous qryHeading depending on the contents of a table) the datasheet subform should show all of the column headings that appear in the query qryHeading. Could you be explicit in your VBA code suggestions? I am experienced with MS Access (using macros previously) and SQL but am a relative novice with respect to VBA code. Thanks



Similar Threads
Thread Thread Starter Forum Replies Last Post
column headings mary555 Crystal Reports 0 July 18th, 2006 12:30 PM
Dynamic Datasheet Form Field Headings Wrong pkaptein1 Access 1 June 12th, 2005 11:33 AM
Datasheet View - Customize Dataman Access 0 February 16th, 2004 02:07 PM
Datasheet View Column Width - VBA Dataman Access 1 February 5th, 2004 02:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.