How To Modify A Field On A Form For Particular Records?

Blazin J

New Member
Joined
Mar 21, 2004
Messages
44
Sorry to show my ignorance, but I need some help.

I am using Access 2007 and I have a form that is generated from a table (let's call it [MASTER]).

On this form, I have several text box fields (let's call them [FIELD1], [FIELD2], etc)

As I use this form to navigate through the records, I would like to the value of [FIELD1] to affect the format of [FIELD2]. For example, if [FIELD1] = Yes, then I would like [FIELD2] to be visible; and if [FIELD1] = No, then I would like [FIELD2] to be invisible.

I have written the following sub:

HTML:
Private Sub FIELD2 AfterUpdate()
   If FIELD1.Value = "Yes" Then FIELD2.Visible = True Else FIELD2.Invisible = False
End Sub

This works for the current record I am viewing, but when I navigate to another record the format of FIELD2 remains in the last state it was set...

What I would like is this: As I use the form to navigate through the record set, I would like Access to "read" the value of [FIELD1] for that record and set the format of [FIELD2] for that record accordingly.

What am I do wrong and how can I fix this?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Are you sure you want the word "Invisible" in that line of code...
 
Upvote 0
Oops, sorry, lol! I just jotted out some sample code to get my point across in this forum, not sharing actual code.
 
Upvote 0
Spark one up and then post some real code!
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,049
Latest member
THMarana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top