How to remind users to fill certain fields?

P

Penny

Hi All,

I have made a table and form that has one record for each 'Recording' my
friend stocks in his record store. The form has the standard record
navigation buttons at the bottom, so when he needs to add a new 'Recording'
he clicks the '*> - New Record' button and is presented with an empty form
to fill out. He tends to forget filling out a field or two quite often and
would like the database to 'gently' remind him that he forgot to do so.
Setting the fields to 'Required' in the table seems to be one answer but are
there any alternatives that may be less intrusive?

Regards,

Penny.
 
G

Guest

hi,
Assuming that you have a button that put the new record in
the table, you can and code like this.
if IsNull(me.requiredTextbox1) then
msgbox("pleeas fill in RequiredTextbox1")
exit sub
else
if IsNull(me.requiredtextbox2) then
msgbox("Please fill in requiredtextbox2")
Exit sub
end if
end if
 
G

Guest

hi again,
i forgot to mention.....put the code at the begining so
that the exit sub part will kill the code before it gets
started and all required fields are filled in.
 
P

Penny

Thanks guys,

Is the update event the correct event to use. With a standard form like this
one, if you click on the new record button Access automatically takes you to
an empty fields record (seemingly at the end of the recordset). There's no
button you click to 'Save' the record, you just navigate away from it. So I
can't figure out in what event to place the code.

Penny.
 
A

axeman422

If you do this in before update you will get the messages if he has fields
empty but it will still go to the next record anyway after you click ok and
only 1 message will pop up even tho he may have 3 fields empty but if he goes
back and only fills in 1 so 2 are still empty no message will come up because
the information has already been sent to the table so kinda redundant maybe
just a message saying remember to check all fields might be better

Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNull(Me.nameoftextbox) Then
MsgBox ("please fill in CD name")

Else

If IsNull(Me.nameoftextbox) Then
MsgBox ("Please fill in quantity")

Else

If IsNull(Me.nameoftextbox) Then
MsgBox ("please fill in Distibutor Name")


End If
End If
End If
End Sub

nameoftextbox is the name of the text box where he is putting in the data if
you change to design view and click on the text box and click properties it
is the name at the very top of the all tab change the part inside the (" ")
after msgbox to display what ever you want him to see
 
A

axeman422

if you really want to make sure he puts something in a field what you can
also do is go to the design view of the table click on the field you want to
make sure he puts something in and chane the "required" value to yes it's no
by default
it's down the botton on the general tab
that will also stop it from going to the next record it will stay at that
record until all the fields you changed to required yes have something in
them
 
P

Penny

Thanks axeman422,

I'll work with what you've given me for a compromise.

All the best,

Penny
 
Top