Check to see if a specific field exist on form

S

SF

Hi,

I want to check if a field called Owner exist on the form

If FieldOwnerExist then
ZZNAV_OWNER = Screen.ActiveForm![SubForm].Form![Owner]
end if

Could someone advice

SF
 
J

Jeanette Cunningham

Hi SF,

I think you are asking if the field Owner has a value (meaning that it's not
null or empty).
If I have not understood please let me know.
To do that you can use:
If not isnull(me.subform.form.owner) if this code is on the form with the
field called Owner.

If not isNull(me.subform.form.owner) then
zznav_owner = me.subform.form.owner
end if

As you are using Screen.ActiveForm, this changes things a bit.
Where is the code zznav_owner = Screen.ActiveForm![SubForm].Form![Owner] ?
Is it on the form or is it in a standard module?

Jeanette Cunningham
 
J

John W. Vinson

Hi,

I want to check if a field called Owner exist on the form

If FieldOwnerExist then
ZZNAV_OWNER = Screen.ActiveForm![SubForm].Form![Owner]
end if

Could someone advice

SF

Tables and Queries have fields: forms don't. They have Controls.

What exactly are you trying to determine? If there is a Control named [Owner]
on the subform? If there is a field named Owner in the subform's Recordsource?
If the bound control named Owner on the subform has a non-null value? or what?

John W. Vinson [MVP]
 
S

SF

Yes. I want to check if Controlnamed.[Owner] exist, if yes assisgn the value

SF

John W. Vinson said:
Hi,

I want to check if a field called Owner exist on the form

If FieldOwnerExist then
ZZNAV_OWNER = Screen.ActiveForm![SubForm].Form![Owner]
end if

Could someone advice

SF

Tables and Queries have fields: forms don't. They have Controls.

What exactly are you trying to determine? If there is a Control named
[Owner]
on the subform? If there is a field named Owner in the subform's
Recordsource?
If the bound control named Owner on the subform has a non-null value? or
what?

John W. Vinson [MVP]
 
Top