form field if IsNull then

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to have a field set sot that if after update (or) before update
(not sure)
If field was not updated then got to (another control)
Is this possible?


Thanks in advance.
 
Lin said:
I would like to have a field set sot that if after update (or) before
update (not sure)
If field was not updated then got to (another control)
Is this possible?

For the control, neither the BeforeUpdate event nor the AfterUpdate
event will fire if the control is not updated by user action. It's not
clear to me what you want to do. If the control receives the focus at
some point, by tabbing through the controls on the form, for example,
you can use the control's Exit event to determine whether the control is
Null and take some action; e.g., SetFocus to another control that isn't
next in the tab order. But that doesn't help if the user "clicks
around" on the form and bypasses that control entirely.
 
Hi Dirk thanks for that. Here's my sample:

On form I have these fields; Surname1/Surname2/Surname3/GivenName

If surname1 is filled, fine I go to Surname2 but if I have no name to insert
at Surname2 then I want to got directly to GivenName.

Thanks again.....
Regards.
 
Lin said:
Hi Dirk thanks for that. Here's my sample:

On form I have these fields; Surname1/Surname2/Surname3/GivenName

If surname1 is filled, fine I go to Surname2 but if I have no name to
insert at Surname2 then I want to got directly to GivenName.

Any situation where you have field names with sequential numbers, such
as "Surname1", "Surname2", etc., probably would be better solved by a
related table wherein each of those fields is actually a new record.
Then there would be a subform to show those records.

However, the simple answer to what you are trying to do is probably to
use an Exit event like this:

'----- start of example code -----
Private Sub Surname2_Exit(Cancel As Integer)

If IsNull(Me!Surname2) Then
Me!GivenName.SetFocus
End If

End Sub
'----- end of example code -----
 
Back
Top