Need to set default value of subform control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My conditions are:

Main form name = FAddTiers
Embedded subform name = FAddTiersSub
Controls in subform = Tier1Connect, Tier1Sort

Initially, I need to set the value of Tier1Sort = Tier1Connect

I have tried numerous unsuccessful variations to set the default value of
Tier1Sort. The last one is:
=[Forms]![FAddTiers]![FAddTiersSub].[Form]![Tier1Connect]

Any help?
 
The reference looks correct *provided* that [FAddTiersSub] is the name of
the Subform*Control* (think of the SubformControl as the empty rectangle
where the "Subform" sits) which can be different from the name of the Form
being used as the "Subform").
 
Thanks! for the quick reply.

Yes, [FAddTiersSub] is the name of the subform control. The underlying form
is called [FAddTier1]. The default value in the underlying form is blank. I
have this string

=[Forms]![FAddTiers]![FAddTiersSub].[Form]![Tier1Connect]

in the "default value" of my target control, [Tier1Sort] in the subform.
However, it does not pick up the value from the control, [Tier1Connect]. It
does not crash and it does not display "#Name?". It just does not work.

I am wondering if I am approaching the problem incorrectly.

I need the control [Tier1Sort] to initially pick up the value of
[Tier1Connect], which I can then modify if necessary.

The control source for [Tier1Connect] comes from a field [Tier1] in the
source table. That field is set to AutoNumber. It fills automatically when I
enter a value anywhere in the subform [FAddTiersSub.]

Perhaps I am pursuing circular reasoning, and I am asking [Tier1Sort] to
pick up a value that actually does not exist at the moment I make the request.

In which case, is there a way I can set the default value of [Tier1Sort]
with a macro?

Thanks.
TCox

Van T. Dinh said:
The reference looks correct *provided* that [FAddTiersSub] is the name of
the Subform*Control* (think of the SubformControl as the empty rectangle
where the "Subform" sits) which can be different from the name of the Form
being used as the "Subform").

--
HTH
Van T. Dinh
MVP (Access)


coxrail said:
My conditions are:

Main form name = FAddTiers
Embedded subform name = FAddTiersSub
Controls in subform = Tier1Connect, Tier1Sort

Initially, I need to set the value of Tier1Sort = Tier1Connect

I have tried numerous unsuccessful variations to set the default value of
Tier1Sort. The last one is:
=[Forms]![FAddTiers]![FAddTiersSub].[Form]![Tier1Connect]

Any help?
 
The DefaultValue won't work in this case.

Since DefaultValue has to be set before the Record addition starts and at
this stage, [Tier1Connect] is Null. Hence, you simply get blank (Null) in
Tier1Sort.

Try setting the Value (not DefaultValue) of the Tier1Sort using the
AfterUpdate Event of the Control bound to Tier1Connect.
 
Thanks again for your quick reply. I will take that approach.

TCox

Van T. Dinh said:
The DefaultValue won't work in this case.

Since DefaultValue has to be set before the Record addition starts and at
this stage, [Tier1Connect] is Null. Hence, you simply get blank (Null) in
Tier1Sort.

Try setting the Value (not DefaultValue) of the Tier1Sort using the
AfterUpdate Event of the Control bound to Tier1Connect.

--
HTH
Van T. Dinh
MVP (Access)




coxrail said:
Thanks! for the quick reply.

Yes, [FAddTiersSub] is the name of the subform control. The underlying form
is called [FAddTier1]. The default value in the underlying form is blank. I
have this string

=[Forms]![FAddTiers]![FAddTiersSub].[Form]![Tier1Connect]

in the "default value" of my target control, [Tier1Sort] in the subform.
However, it does not pick up the value from the control, [Tier1Connect]. It
does not crash and it does not display "#Name?". It just does not work.

I am wondering if I am approaching the problem incorrectly.

I need the control [Tier1Sort] to initially pick up the value of
[Tier1Connect], which I can then modify if necessary.

The control source for [Tier1Connect] comes from a field [Tier1] in the
source table. That field is set to AutoNumber. It fills automatically when I
enter a value anywhere in the subform [FAddTiersSub.]

Perhaps I am pursuing circular reasoning, and I am asking [Tier1Sort] to
pick up a value that actually does not exist at the moment I make the request.

In which case, is there a way I can set the default value of [Tier1Sort]
with a macro?

Thanks.
TCox
 
Back
Top