Re: Check for missing field in edit form



Sue,

I can't reproduce the behaviour you're experiencing. Can you post the exact
code you have, and the steps you take to reproduce it (from the time you
open the form)?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Sue Wilkes" <SueWilkes@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0426BB00-168E-443B-8292-7719B56760F4@xxxxxxxxxxxxxxxx
Thank you Graham the code does display the message however when I right
click
on the hyperlink control and follow the menu down to 'edit hyperlink' it
keeps looping the error message and I cannot continue. I've tried setting
focus with 'Me.[Hyperlink1].SetFocus but this also gives an error message
run
time 2108 any help is appreciated for this green newbie. many thanks
Sue

"Graham R Seach" wrote:

Sue,

The easiest way is to check the field's length.
If Len("" & Me.ForwardedTo) = 0 Then
'The field is empty
End If

I always like to trim the value too:
If Len("" & Trim(Me.ForwardedTo)) = 0 Then
'The field is empty
End If

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Sue Wilkes" <SueWilkes@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0B956EBD-9918-4B9A-AD0B-3666BCF6B795@xxxxxxxxxxxxxxxx
I have a form (RegEditForm) linked to a control source table (HYInReg)
In
the
table the field Hyperlink1 is set Yes for required. If a user makes a
change
and accidently leaves any of the other fields blank I can get a message
to
appear using the beforeupdate event procedure as follows.
Private Sub ForwardedTo_BeforeUpdate(Cancel As Integer)
If IsNull(Me.[ForwardedTo]) And Not IsNull(Me.[RegisterNumber]) Then
MsgBox "FORWARDED TO DETAILS MUST BE COMPLETED BEFORE SAVING IS
PERMITTED"
Cancel = True 'wont let the user continue
End If
End Sub
However, if the user deletes the hyperlink that was there I am unable
to
get
the same code to recognise that the field is now empty and display an
error
message. I have tried using the same code in the controls other events
but
no luck. Any help would be greatly appreciated I'm at a loss what to
try
next. Many thanks





.