Forms & Subforms

  • Thread starter Thread starter Pam
  • Start date Start date
P

Pam

I’m making a Reapirs Tracking Database for someone. On the Repair Entry Form
I have two sub forms (not visible)
1. Client Contact Subform
2. Agent Contact Subform
So that when a Client or Agent Contact Person is chosen from a drop down
(combo box) the fields below with “Tel No†,“Fax Noâ€, “Email†are
automatically updated with the relevant information.
This is working fine except that on a “new†record, the fields where the
Agent information fields, “Tel No†etc. should be blank, it shows #Error, but
not so where the Client information is.
In both sections of the form I have put the same expression in the control
source
=[Repairs Client Contact Subform]![CLCP Tel No]
=[Repairs Agent Contact Subform]![AGCP Tel No]
I have also tried it with the whole string something along the lines of
=Forms![Form Name]![Subform]!Form[Subform Name],[Field]; (I’m not sure
exactly but I copied them from answers to other people’s questions). This
returns a NAME?? error
My 1st scenario works for the Client fields, but not the Agent fields.
However once the information in the drop down has been entered the #Error
message disappears and the information updates.
So whatever I’ve done works, but WHY the #Error message on a new record for
data realting to the one sub form and not the other?
 
Because initially there is no record in the subform for the control to read
and obtain the value; hence, the error. After you select an agent, a record
is produced in the subform, and the control has something to read. Try using
this as the Control Source:

=IIF(IsError([Repairs Agent Contact Subform]![AGCP Tel No]),Null,[Repairs
Agent Contact Subform]![AGCP Tel No])
 
THANKS so much, works great!!!

Ken Snell said:
Because initially there is no record in the subform for the control to read
and obtain the value; hence, the error. After you select an agent, a record
is produced in the subform, and the control has something to read. Try using
this as the Control Source:

=IIF(IsError([Repairs Agent Contact Subform]![AGCP Tel No]),Null,[Repairs
Agent Contact Subform]![AGCP Tel No])
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


Pam said:
I'm making a Reapirs Tracking Database for someone. On the Repair Entry
Form
I have two sub forms (not visible)
1. Client Contact Subform
2. Agent Contact Subform
So that when a Client or Agent Contact Person is chosen from a drop down
(combo box) the fields below with "Tel No" ,"Fax No", "Email" are
automatically updated with the relevant information.
This is working fine except that on a "new" record, the fields where the
Agent information fields, "Tel No" etc. should be blank, it shows #Error,
but
not so where the Client information is.
In both sections of the form I have put the same expression in the control
source
=[Repairs Client Contact Subform]![CLCP Tel No]
=[Repairs Agent Contact Subform]![AGCP Tel No]
I have also tried it with the whole string something along the lines of
=Forms![Form Name]![Subform]!Form[Subform Name],[Field]; (I'm not sure
exactly but I copied them from answers to other people's questions). This
returns a NAME?? error
My 1st scenario works for the Client fields, but not the Agent fields.
However once the information in the drop down has been entered the #Error
message disappears and the information updates.
So whatever I've done works, but WHY the #Error message on a new record
for
data realting to the one sub form and not the other?
 
Back
Top