Enable form

jbphoenix

Registered User.
Local time
Today, 15:25
Joined
Jan 25, 2007
Messages
98
Are all fields in the main form required before the subform can become visible?
 
No, only 4 fields are required.
 
ok u can do an event in the afterupdate of the form
that checks to see if the fields are null if they are dont do anything if they arent then
Code:
If (Me.yourtxtfieldname & "" = "") OR .... for all the fields
Then
Else
Me.yoursubformname.Enabled=True
end if
 
ok u can do an event in the afterupdate of the form
that checks to see if the fields are null if they are dont do anything if they arent then
Code:
If (Me.yourtxtfieldname & "" = "") OR .... for all the fields
Then
Else
Me.yoursubformname.Enabled=True
end if

I think you would want
If (Me.yourtxtfieldname & "" = "") AND
instead of OR. If you use OR, then only one required field would need to be filled out before it would show. Also, if there are 4 required fields and they are set as required in the table, then when the form's AfterUpdate event would occur is only after all required fields are completed anyway.

For my current project, I have the code in a public module and then just call it in each control's after update event to check to see if all required fields are filled out and if so it will display the subform.

You will also need to set the Form's On Current event to check to see if the record being moved to is new or old. If new, it would set the subform back to invisible and if it has previous data it doesn't. For that one, you should be able to check to see if the primary key is completed as it would need to be if it was an old record, and there wouldn't be one if it was new.
 

Users who are viewing this thread

Back
Top Bottom