Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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
 
Old May 3rd, 2006, 08:22 AM
Authorized User
 
Join Date: May 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying data fields from sub forms

Require assistance in the following: In Access 2003 how to display a current data field entry from a sub form (child by identifier) in the main form after the sub form was updated?

The data field name in the sub form is for a Supervisor, as an employee changes Supervisors and the sub form is updated based on end date of 12/31/9999 the main form Supervisor data field should display the current Supervisors name. Can this be down through a select query?

Any help anyone can provide would be appreciated.
 
Old May 3rd, 2006, 10:06 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

From the sub form, Me.Parent.Supervisor.text = Me.Supervisor.Text. (I can never remember: the property might be .Value...)
 
Old May 4th, 2006, 07:48 AM
Authorized User
 
Join Date: May 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Brian I'm assuming that I am using an event procedure under After Update within the sub form would that be correct?
 
Old May 4th, 2006, 10:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

What you can do is put an AfterUpdate event in the supervisor's end date. If the end date is null and that means the supervisor still works there, then

Me.Parent.txtSupervisor = DLookUp("[strSupervisor]", "tblSupervisors", "[dtmEndDate] Is Null")

This is using fake names for the supervisor textbox, the fields in the table, and the table name listing the supervisors. Replace those with your real names.

The .Value (rather than the .Text) property is not needed but can be specified.

Also put that code in the main form's ON OPEN event.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old May 8th, 2006, 08:12 AM
Authorized User
 
Join Date: May 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the feedback. Are there any good resources’ regarding event procedures for a beginner to intermediate level that anyone is aware of? Books or websites? Any recommendations would help, please let me know, thank you.
 
Old May 8th, 2006, 02:40 PM
Authorized User
 
Join Date: May 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The information provided worked great here is what I ended up doing:

On the main form under the Supervisor data field control source I used the following, =DLookUp("[Name]","qryName","[qryName]![EmployeeID]=Forms!frm_main_employee!frm_team_sub.Form!team_su pervisor")

Then I added an auto number id to the subform table [teams] and created a select query to order the inputted data as descending which now displays the current entry within the field.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying Table Column/Fields names in a listbox Durkee VB.NET 2002/2003 Basics 4 September 25th, 2007 03:37 PM
Memo Fields with Windows Forms in C# jim.stanley Access 0 November 15th, 2004 05:55 PM
displaying multiple fields in columns rbegonia Classic ASP Basics 3 July 31st, 2004 08:37 PM
displaying multiple fields in columns rbegonia XSLT 0 July 29th, 2004 02:21 PM
Inserting forms fields into Access tsparker Classic ASP Databases 1 October 9th, 2003 03:24 AM





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