PC Review


Reply
Thread Tools Rate Thread

How do I populate a subform field with a value from the main form?

 
 
SSi308
Guest
Posts: n/a
 
      17th May 2010
I have a form called ContractsIn which has a subform called
ContractsInAndHours.
The main part of the form consists of:
Employees.ID
Employees.Name

The subform has the fields:
ContractsAndHours.ID
ContractsAndHours.Name
ContractsAndHours.DailyHoursWorked
ContractsAndHours.ContractOut

This form is used by the supervisor to enter the hours worked and the
contracts in for each day.
When entering hours and contracts for each employee I would like the Name
field in the subform automatically filled in with the name in the main form
when entering through the field.

Can this be accomplished?

 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      17th May 2010
You don't ever need to store the name in 2 places. The only data that should
ever be duplicated is the key.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"SSi308" <(E-Mail Removed)> wrote in message
news:8397B7AC-C8C5-4B9F-A57C-(E-Mail Removed)...
>I have a form called ContractsIn which has a subform called
> ContractsInAndHours.
> The main part of the form consists of:
> Employees.ID
> Employees.Name
>
> The subform has the fields:
> ContractsAndHours.ID
> ContractsAndHours.Name
> ContractsAndHours.DailyHoursWorked
> ContractsAndHours.ContractOut
>
> This form is used by the supervisor to enter the hours worked and the
> contracts in for each day.
> When entering hours and contracts for each employee I would like the Name
> field in the subform automatically filled in with the name in the main
> form
> when entering through the field.
>
> Can this be accomplished?
>



 
Reply With Quote
 
SSi308
Guest
Posts: n/a
 
      18th May 2010
How does the table know who the record is for when running reports?
For example the ContractsAndHours subform was created from the
ContractsAndHours table. If I do a query on the ContractsAndHours table
information and there is no name field how do I sort by employee name?

Thanks for the reply it is very much appreciated.

"Arvin Meyer [MVP]" wrote:

> You don't ever need to store the name in 2 places. The only data that should
> ever be duplicated is the key.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.accessmvp.com
> http://www.mvps.org/access
>
>
> "SSi308" <(E-Mail Removed)> wrote in message
> news:8397B7AC-C8C5-4B9F-A57C-(E-Mail Removed)...
> >I have a form called ContractsIn which has a subform called
> > ContractsInAndHours.
> > The main part of the form consists of:
> > Employees.ID
> > Employees.Name
> >
> > The subform has the fields:
> > ContractsAndHours.ID
> > ContractsAndHours.Name
> > ContractsAndHours.DailyHoursWorked
> > ContractsAndHours.ContractOut
> >
> > This form is used by the supervisor to enter the hours worked and the
> > contracts in for each day.
> > When entering hours and contracts for each employee I would like the Name
> > field in the subform automatically filled in with the name in the main
> > form
> > when entering through the field.
> >
> > Can this be accomplished?
> >

>
>
> .
>

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      18th May 2010
On Tue, 18 May 2010 07:19:01 -0700, SSi308 <(E-Mail Removed)>
wrote:

>How does the table know who the record is for when running reports?
>For example the ContractsAndHours subform was created from the
>ContractsAndHours table. If I do a query on the ContractsAndHours table
>information and there is no name field how do I sort by employee name?


Join the Employees table in the query: pull the contract and hour information
from the ContractsAndHours table, and the name from the Employee table. That's
what relational databases DO - let you combine data from multiple related
tables into one result.

If you're assuming that the Report must be based on a single table containing
all the needed information, you're missing the real power of databases!

--

John W. Vinson [MVP]
 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      19th May 2010
You use a query to sort and the EmployeeID to identify the employee. A join
on EmployeeID from the employees table will display a name.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"SSi308" <(E-Mail Removed)> wrote in message
news:71EA33BC-6735-4070-992F-(E-Mail Removed)...
> How does the table know who the record is for when running reports?
> For example the ContractsAndHours subform was created from the
> ContractsAndHours table. If I do a query on the ContractsAndHours table
> information and there is no name field how do I sort by employee name?
>
> Thanks for the reply it is very much appreciated.
>
> "Arvin Meyer [MVP]" wrote:
>
>> You don't ever need to store the name in 2 places. The only data that
>> should
>> ever be duplicated is the key.
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.accessmvp.com
>> http://www.mvps.org/access
>>
>>
>> "SSi308" <(E-Mail Removed)> wrote in message
>> news:8397B7AC-C8C5-4B9F-A57C-(E-Mail Removed)...
>> >I have a form called ContractsIn which has a subform called
>> > ContractsInAndHours.
>> > The main part of the form consists of:
>> > Employees.ID
>> > Employees.Name
>> >
>> > The subform has the fields:
>> > ContractsAndHours.ID
>> > ContractsAndHours.Name
>> > ContractsAndHours.DailyHoursWorked
>> > ContractsAndHours.ContractOut
>> >
>> > This form is used by the supervisor to enter the hours worked and the
>> > contracts in for each day.
>> > When entering hours and contracts for each employee I would like the
>> > Name
>> > field in the subform automatically filled in with the name in the main
>> > form
>> > when entering through the field.
>> >
>> > Can this be accomplished?
>> >

>>
>>
>> .
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate subform field on Afterupdate of main form field RW Microsoft Access VBA Modules 6 26th May 2009 09:06 PM
Populate subform field on Afterupdate of main form field RW Microsoft Access VBA Modules 0 26th May 2009 06:39 PM
Populate subform field with data from main form field Shiller Microsoft Access Forms 0 23rd Aug 2007 04:51 PM
Populate subform field with 2 digits of main form field =?Utf-8?B?emNqeGcw?= Microsoft Access Forms 1 19th Jul 2006 11:48 PM
Main Form Subform on Data Entry populate field =?Utf-8?B?SUNNb20=?= Microsoft Access Forms 0 1st Apr 2005 10:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:24 PM.