Re: How do I make a List box Prompt the user to Populated the fiel
- From: John W. Vinson <jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 12 Jun 2007 09:33:08 -0600
On Tue, 12 Jun 2007 02:03:00 -0700, Arlene <Arlene@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
John,
Thank you for reply to my question. I would like the Prompt to be when they
try to leave the from
Open the form in design view; view its Properties. On the Events tab find the
BeforeUpdate event. Click the ... icon by that event and choose Code Builder.
Access will give you two lines:
Private Sub Form_BeforeUpdate(Cancel as Integer)
End Sub
You can put whatever code you like in between; you can use MsgBox to issue a
prompt, and you can set Cancel to True to prevent the user from closing the
form. For example:
Private Sub Form_Close(Cancel as Integer)
Dim iAns As Integer
If IsNull(Me!somecontrolname) Then
Cancel = True ' cancel the update of the record
iAns = MsgBox("Yadayada is blank! Fill it or click Cancel to erase:", _
vbOKCancel)
If iAns = vbOK Then
Me!Yadayada.SetFocus ' go to the required control
Else
Me.Undo ' erase the entire form so they can start over
End If
End If
End Sub
John W. Vinson [MVP]
.
- References:
- Re: How do I make a List box Prompt the user to Populated the fiel
- From: John W . Vinson
- Re: How do I make a List box Prompt the user to Populated the fiel
- Prev by Date: Re: On update, move new data to next empty location
- Next by Date: RE: Emailers and Add-ons
- Previous by thread: Re: How do I make a List box Prompt the user to Populated the fiel
- Next by thread: Re: How do I make a List box Prompt the user to Populated the fiel
- Index(es):
Relevant Pages
|
Loading