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
|
|||
|
|||
Help
Ok, I have created a form with various fields. I would like to make certain
fields required information. In other words a certain field would require you to put information into before you can close the form or move to the next field. thanks for you help |
#2
|
|||
|
|||
Help
On Tue, 8 Jun 2004 13:55:37 -0400, "Ken" jeepdakota(NO
wrote: Ok, I have created a form with various fields. I would like to make certain fields required information. In other words a certain field would require you to put information into before you can close the form or move to the next field. thanks for you help Two ways (at least) to do this: - Open the Table which will contain this data and select each of these fields; set the field's Required property to True. - For a friendlier error message, use the Form's BeforeUpdate event. Invoke the Code Builder and put code like Private Sub Form_BeforeUpdate(Cancel as Integer) Dim iAns As Integer If IsNull(Me!txtReqFieldA) Then iAns = MsgBox("Please fill in Field A; or Cancel to clear form", _ vbOKCancel) If iAns = vbOK Then Cancel = True ' cancel the update to the table Me!txtReqFieldA.SetFocus ' move the user to the control Else Me.Undo ' erase the entire form to start over Cancel = True End If End If End Sub John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
Thread Tools | |
Display Modes | |
|
|