Greying out/disabling field based on other fields on form/sub-form (1 Viewer)

sparkes84

Registered User.
Local time
Today, 15:55
Joined
Apr 2, 2009
Messages
16
Hello everyone,

Really need some help as I have tried for quite some time now without success.

I am wanting to grey out/disable a field on a form based on entries in two other fields being the same. One of these fields that contains the data to be referenced in on a sub-form.

The form is called 'Payment_Information-Form', the field to be greyed out/disabled is called 'SUF A Paid?'

The fields that are being referenced are: 'Set up fee in £s (SUF) Recrt Restriction A <=' which is on the main form, and 'SUF_Letter' which is on a sub-form (within the main form). The sub-form is called 'Costings_11_Previously_Paid_SUF subform'.

If 'Set up fee in £s (SUF) Recrt Restriction A <=' equals 'SUF_Letter' then grey out.

I tried the following formula in both the On Current and After Update sections but it hasn't work.

=IIf([Forms]![Payment_Information-Form]![Costings_11_Previously_Paid_SUF subform].[Form]![SUF_Letter]=[Set up fee in £s (SUF) Recrt Restriction A <=],[SUF A Paid?].[Visible]=True,[SUF A Paid?].[Visible]=False)

If somebody could help me, I'd be ever so grateful! I've used an 'iif' statement rather than VBA as I severely struggle with VBA.

Many thanks,
Sally
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:55
Joined
Aug 30, 2003
Messages
36,125
I don't know that you can do it that way. Simplest is probably Conditional Formatting, using Expression Is.
 

Solo712

Registered User.
Local time
Today, 10:55
Joined
Oct 19, 2012
Messages
828
Hello everyone,

Really need some help as I have tried for quite some time now without success.

I am wanting to grey out/disable a field on a form based on entries in two other fields being the same. One of these fields that contains the data to be referenced in on a sub-form.

The form is called 'Payment_Information-Form', the field to be greyed out/disabled is called 'SUF A Paid?'

The fields that are being referenced are: 'Set up fee in £s (SUF) Recrt Restriction A <=' which is on the main form, and 'SUF_Letter' which is on a sub-form (within the main form). The sub-form is called 'Costings_11_Previously_Paid_SUF subform'.

If 'Set up fee in £s (SUF) Recrt Restriction A <=' equals 'SUF_Letter' then grey out.

I tried the following formula in both the On Current and After Update sections but it hasn't work.

=IIf([Forms]![Payment_Information-Form]![Costings_11_Previously_Paid_SUF subform].[Form]![SUF_Letter]=[Set up fee in £s (SUF) Recrt Restriction A <=],[SUF A Paid?].[Visible]=True,[SUF A Paid?].[Visible]=False)

If somebody could help me, I'd be ever so grateful! I've used an 'iif' statement rather than VBA as I severely struggle with VBA.

Many thanks,
Sally

Further to Paul's comment. The scheme that you are proposing cannot be applied in a form-subform/one-to-many situation. The equality test between the two fields can not be performed as it is unclear which of the subform records is referenced. You might be able to do it your way if you have a single-record subform.

Best,
Jiri
 

sparkes84

Registered User.
Local time
Today, 15:55
Joined
Apr 2, 2009
Messages
16
Thank you for your replies and suggestion of using conditional formatting. I have it working via that method. It hadn't crossed my mind at all, so many thanks.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:55
Joined
Aug 30, 2003
Messages
36,125
Happy to help.
 

Users who are viewing this thread

Top Bottom