Subform data on main form

L

Linkerbink

I have an employee database with several tables, two of
which are Staff Data and Hire Date, which are joined by
social security number. The input (main)form uses the
Staff Data table, and the Hire Date info (hire date,
termination date, reason, etc.) is displayed on the Hire
Date Subform through a query.

At the Form Header I have displayed the employee's name
and SSN which come from the main form (Staff Data), and
would also like to display whether or not the employee is
active (Termination Date is null), or inactive
(Termination date is not null). I placed an unbound text
box in the form header, set the control source to:
=IIf([Forms]![Hire Date Form]![Termination Date]Is
Null, "Active","Inactive") but all I get is #Name? I've
tried all sorts of variations but no luck. Am I way off
base here? Any help would be appreciated. I'm self-
taught and relatively new at Access (obviously!)
 
A

Art

Hi Linker
You need to refer to the subform control and not
the subform itself.
IIf(Me.MySubFormCtrl.Form.RecordSouce)

Hope This Helps
 
K

Kevin Sprinkel

The Hire Date subform is itself a control, which has a
name you can see in its Properties. Try:

IIf([Forms]![subformcontrolname].Form![Termination Date]
Is Null, "Active","Inactive")

HTH
Kevin Sprinkel
 
G

Guest

Hi, Art! I guess I'm dense...I don't get the "ME" portion
of your formula. Anyway, I found a (rather cumbersome)
way around it...I made a new subform with just the unbound
control and put it in the header...works fine, except for
a new glitch which I was afraid of and maybe you can help
with. We have a few instances in which an employee came
back to work after having resigned. In the Hire Date form
there will be TWO entries...one with a termination date
(from when he left), and one with a new, more recent hire
date and NO terminated date (currently employed/active).
Is there a way to have it pull the data from the record
with the most RECENT hire date? thanks in advance!
-----Original Message-----
Hi Linker
You need to refer to the subform control and not
the subform itself.
IIf(Me.MySubFormCtrl.Form.RecordSouce)

Hope This Helps
-----Original Message-----
I have an employee database with several tables, two of
which are Staff Data and Hire Date, which are joined by
social security number. The input (main)form uses the
Staff Data table, and the Hire Date info (hire date,
termination date, reason, etc.) is displayed on the Hire
Date Subform through a query.

At the Form Header I have displayed the employee's name
and SSN which come from the main form (Staff Data), and
would also like to display whether or not the employee is
active (Termination Date is null), or inactive
(Termination date is not null). I placed an unbound text
box in the form header, set the control source to:
=IIf([Forms]![Hire Date Form]![Termination Date]Is
Null, "Active","Inactive") but all I get is #Name? I've
tried all sorts of variations but no luck. Am I way off
base here? Any help would be appreciated. I'm self-
taught and relatively new at Access (obviously!)
.
.
 
G

Guest

Hey...I managed to figure it out! Linkerbink
-----Original Message-----
Hi, Art! I guess I'm dense...I don't get the "ME" portion
of your formula. Anyway, I found a (rather cumbersome)
way around it...I made a new subform with just the unbound
control and put it in the header...works fine, except for
a new glitch which I was afraid of and maybe you can help
with. We have a few instances in which an employee came
back to work after having resigned. In the Hire Date form
there will be TWO entries...one with a termination date
(from when he left), and one with a new, more recent hire
date and NO terminated date (currently employed/active).
Is there a way to have it pull the data from the record
with the most RECENT hire date? thanks in advance!
-----Original Message-----
Hi Linker
You need to refer to the subform control and not
the subform itself.
IIf(Me.MySubFormCtrl.Form.RecordSouce)

Hope This Helps
-----Original Message-----
I have an employee database with several tables, two of
which are Staff Data and Hire Date, which are joined by
social security number. The input (main)form uses the
Staff Data table, and the Hire Date info (hire date,
termination date, reason, etc.) is displayed on the Hire
Date Subform through a query.

At the Form Header I have displayed the employee's name
and SSN which come from the main form (Staff Data), and
would also like to display whether or not the employee is
active (Termination Date is null), or inactive
(Termination date is not null). I placed an unbound text
box in the form header, set the control source to:
=IIf([Forms]![Hire Date Form]![Termination Date]Is
Null, "Active","Inactive") but all I get is #Name? I've
tried all sorts of variations but no luck. Am I way off
base here? Any help would be appreciated. I'm self-
taught and relatively new at Access (obviously!)
.
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top