Required field Box confusion !

Paul Cooke

Registered User.
Local time
Today, 23:26
Joined
Oct 12, 2001
Messages
288
Hi Guys

I have a field "First Name" that is required on my bound form. If the field is left empty i get the default error message ... you must enter a value blah blah blah...

Firstly is there a way to change this msg to something more user friendly? and secondly I also have some strConv code in the Lost Focus event box of this field

Code:
FirstName.Value = StrConv(FirstName, vbProperCase)

This works fine if i actually enter something but stops the code if the field is empty.

I have tried adding

Code:
If IsNull (me.FirstName) = True Then
MsgBox "Enter Name", , "Name Required"
Else
FirstName.Value = StrConv(FirstName, vbProperCase)
End If

To be honest I have not got a clue whas going on so would be really grateful for any advice

Many thanks

Paul
 
You could use the following test in the Form's Before Update event;
Code:
If IsNull (me.FirstName) Then
     MsgBox "Enter Name", , "Name Required"
     Cancel = True
     FirstName.Setfocus
End If
and change your other code to;
Code:
If IsNull (me.FirstName) Then
     MsgBox "Enter Name", , "Name Required"
     [B][COLOR="Red"]Cacnel = True[/COLOR][/B]
Else
     FirstName.Value = StrConv(FirstName, vbProperCase)
End If
 
many thanks John for the reply - that works apart from one small glitch .. the message comes up the first time I try and leave the Firstname field but if i then still don't enter anything it doesnt come up and stops the strconv code bit

any ideas?

Paul
 
scrub that so sorry !! I did not clear out the old lost focus event it works perfectly

Thanks very much
 

Users who are viewing this thread

Back
Top Bottom