If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
require value error message
Hi Guys,
I have a form of which one of the fields is a required field and just wondering how/ where I put the code to present a message box if they fail to enter a value. I was going to use: If MsgBox("This is a required field, " & _ "Have you entered some details?.", vbYesNo) = vbYes Then End If But am unsure where I should place this? I am using a SQL BE with Access FE and currently if the user tries to leave the field blank they get a very unfriendly error message. Can anyone advise please |
#2
|
|||
|
|||
require value error message
Well, you don't validate whether or not a control has data in it by asking
the user, you check the control: Private Sub Form_BeforeUpdate(Cancel As Integer) If Me.YourTextBoxName = "" Or IsNull(Me.YourTextBoxName) Then MsgBox "You Must Fill In the " & YourTextBoxName & " Field!" Cancel = True YourTextBoxName.SetFocus End If End Sub -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201002/1 |
Thread Tools | |
Display Modes | |
|
|