Error Msg Box

A

aubrey

Hi,

I trying to use custom error message boxes. I tried using a syntax i wrote:

Iif(<> 000000000;;_MsgBox(“Field Must Be “9†Digits!â€, “Warning!â€, “TIN
Fieldâ€)

I have no idea if I’m on the right track.

I’m trying to say if the length in a particular field in not 9 digits long
(the first part of the statement, which is also my input mask) have an error
message pup up saying "Field Must Be "9" Digits!"

Any help would be greatly appreciated.

Thanks,
 
W

Wayne-I-M

Try this

Sub SomeField_AfterUpdate()
If Len([SomeField]) <> 9 Then
MsgBox "You have put the wrong number of digits", vbOKOnly, "Ooops"
End If
End Sub

Or you could set an imput mask to get round this ?
 
A

aubrey

Wayne,

sorry for sounding slow but:
where should i imput this formula
and secondly what would be the imput mask to get arount this

Thanks again,
Aubrey

Wayne-I-M said:
Try this

Sub SomeField_AfterUpdate()
If Len([SomeField]) <> 9 Then
MsgBox "You have put the wrong number of digits", vbOKOnly, "Ooops"
End If
End Sub

Or you could set an imput mask to get round this ?


--
Wayne
Manchester, England.



aubrey said:
Hi,

I trying to use custom error message boxes. I tried using a syntax i wrote:

Iif(<> 000000000;;_MsgBox(“Field Must Be “9†Digits!â€, “Warning!â€, “TIN
Fieldâ€)

I have no idea if I’m on the right track.

I’m trying to say if the length in a particular field in not 9 digits long
(the first part of the statement, which is also my input mask) have an error
message pup up saying "Field Must Be "9" Digits!"

Any help would be greatly appreciated.

Thanks,
 
W

Wayne-I-M

Open your form in design view
right click on the text box you are putting the numbers into
Open the properties box
In the Event column go to the AfterUpdate row
select build (...)
slect code
Something like this will show


Private Sub TextBoxName_AfterUpdate()

End Sub

Of course the TextBoxName will be really the name of the control you have
selected

Add th code between the 2 lines so it looks like this


Private Sub TextBoxName_AfterUpdate()
If Len([SomeField]) <> 9 Then
MsgBox "You have put the wrong number of digits", vbOKOnly, "Ooops"
End If
End Sub

Don't forget the change the text box's name to what it really is. You can
find this in the properties box in thr Name row (it's in the Other column)

You can use a input mask to stipulate how data is input into a control (your
text box is a control)
Like this

Right click the control
Open the properties box
In the Data column select the input mask row
add this
000000000
Thats 9 x 0
Of course this is a very basic example. If you press F1 and search on the
Input Mask you will be able to see lots more examples - you could stipulat
letters, digits, space, etc. You could have holders - like this 000000000;;_

You just need to play around with the masks until you find one that suits
your needs.

But the message box should work just as well

Good luck



--
Wayne
Manchester, England.



aubrey said:
Wayne,

sorry for sounding slow but:
where should i imput this formula
and secondly what would be the imput mask to get arount this

Thanks again,
Aubrey

Wayne-I-M said:
Try this

Sub SomeField_AfterUpdate()
If Len([SomeField]) <> 9 Then
MsgBox "You have put the wrong number of digits", vbOKOnly, "Ooops"
End If
End Sub

Or you could set an imput mask to get round this ?


--
Wayne
Manchester, England.



aubrey said:
Hi,

I trying to use custom error message boxes. I tried using a syntax i wrote:

Iif(<> 000000000;;_MsgBox(“Field Must Be “9†Digits!â€, “Warning!â€, “TIN
Fieldâ€)

I have no idea if I’m on the right track.

I’m trying to say if the length in a particular field in not 9 digits long
(the first part of the statement, which is also my input mask) have an error
message pup up saying "Field Must Be "9" Digits!"

Any help would be greatly appreciated.

Thanks,
 
A

aubrey

Finally got it.

Thanks,

Wayne-I-M said:
Open your form in design view
right click on the text box you are putting the numbers into
Open the properties box
In the Event column go to the AfterUpdate row
select build (...)
slect code
Something like this will show


Private Sub TextBoxName_AfterUpdate()

End Sub

Of course the TextBoxName will be really the name of the control you have
selected

Add th code between the 2 lines so it looks like this


Private Sub TextBoxName_AfterUpdate()
If Len([SomeField]) <> 9 Then
MsgBox "You have put the wrong number of digits", vbOKOnly, "Ooops"
End If
End Sub

Don't forget the change the text box's name to what it really is. You can
find this in the properties box in thr Name row (it's in the Other column)

You can use a input mask to stipulate how data is input into a control (your
text box is a control)
Like this

Right click the control
Open the properties box
In the Data column select the input mask row
add this
000000000
Thats 9 x 0
Of course this is a very basic example. If you press F1 and search on the
Input Mask you will be able to see lots more examples - you could stipulat
letters, digits, space, etc. You could have holders - like this 000000000;;_

You just need to play around with the masks until you find one that suits
your needs.

But the message box should work just as well

Good luck



--
Wayne
Manchester, England.



aubrey said:
Wayne,

sorry for sounding slow but:
where should i imput this formula
and secondly what would be the imput mask to get arount this

Thanks again,
Aubrey

Wayne-I-M said:
Try this

Sub SomeField_AfterUpdate()
If Len([SomeField]) <> 9 Then
MsgBox "You have put the wrong number of digits", vbOKOnly, "Ooops"
End If
End Sub

Or you could set an imput mask to get round this ?


--
Wayne
Manchester, England.



:

Hi,

I trying to use custom error message boxes. I tried using a syntax i wrote:

Iif(<> 000000000;;_MsgBox(“Field Must Be “9†Digits!â€, “Warning!â€, “TIN
Fieldâ€)

I have no idea if I’m on the right track.

I’m trying to say if the length in a particular field in not 9 digits long
(the first part of the statement, which is also my input mask) have an error
message pup up saying "Field Must Be "9" Digits!"

Any help would be greatly appreciated.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top