Refresh the subform?

V

Vincdc

Hello,
I have 2 fields on a subform (data entry form), Gender and Pregnancy. If
Gender is male, then the Pregnancy field will be invisible. My codes works
well if one entry is male. However, the hidden Pregnancy field will not show
up if I change gender from male to female or if I moved to another record. I
tried to use Me.Refresh, but it does not work. Any suggestions on it?
Thanks in advance!
 
J

Jeanette Cunningham

Hi Vincdc,
you will need the code to hide and show the pregnancy field in 2 places.
The current event of the form and the after update event of the gender
field.

The current event runs every time the form moves to a new record and shows
or hides the control based on the value in the gender field.

The after update event of the gender field fires every time the data for
that control is changes.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
V

Vincdc

Hi Jeanette,
Thanks for your help! It works. I am just wondering why Me.Refresh does not
work?

Vincdc
 
J

Jeanette Cunningham

Me.Requery makes the form go back to the tables and reload the data, which
picks up all changes to the data in the table. Me.Refresh doesn't.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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