Using if is null (1 Viewer)

NickNeville

Registered User.
Local time
Today, 13:48
Joined
May 17, 2009
Messages
119
Could anyone help with a piece of coding please.

I am trying to enter on a subform an "if Isnull" which refers to a control
on the main form.
Like
If IsNull (mainform!member) then messagebox etc

But cannot get the sequence correct. Can anyone help me please.

Rgds
nick
 

DCrake

Remembered
Local time
Today, 13:48
Joined
Jun 8, 2005
Messages
8,632
Use

Code:
If IsNull(Me.ControlName) Then
   Do This
Else
   Do That
End If
 

vbaInet

AWF VIP
Local time
Today, 13:48
Joined
Jan 22, 2010
Messages
26,374
Code:
If IsNull(Me.Parent.Member) Then
    Msgbox "Hurrah!"
End If
Where are you putting this code?
 

NickNeville

Registered User.
Local time
Today, 13:48
Joined
May 17, 2009
Messages
119
thanks for your quick reply
I am placing it in a "got focus" control in the sub form.

This ok ?

Rgds
nick
 

vbaInet

AWF VIP
Local time
Today, 13:48
Joined
Jan 22, 2010
Messages
26,374
It could be, but why have you thought of putting it in that event?
 

NickNeville

Registered User.
Local time
Today, 13:48
Joined
May 17, 2009
Messages
119
Hi
Well I have a subform which when entered into or got focus I wanted to refer to a control on the main form.
Like
If IsNull (Me.Main form.Memrenewal) then
msg box Etc

But the code doesn't seem to want to work so far.

Nick
 

vbaInet

AWF VIP
Local time
Today, 13:48
Joined
Jan 22, 2010
Messages
26,374
I actually said Me.Parent.Member and not Me.MainForm.Member

If you want it on the got focus then you're using the right event.

What is the name of the subform control?
 

NickNeville

Registered User.
Local time
Today, 13:48
Joined
May 17, 2009
Messages
119
OOOH Aha !
That's a new one on me, I've always referred to a sub form (the other way round)
I thought that you were referring to any "parent or Main form"

Now all is clear
Thanks very very mucho for your patience

Bets rgds
Nick
 

Users who are viewing this thread

Top Bottom