bland fields

L

LG

I have a form and many times they exit out and don't finish entering info
therefore causing blank fields and addtional records. I know I need some
kind of null value but where do I start and where would I place it?

Ex form has id, fname, lname, address , zipcode, city, state. I would like
it to ensure we have atleast lname and address before it saves anything.
 
M

MGFoster

LG said:
I have a form and many times they exit out and don't finish entering info
therefore causing blank fields and addtional records. I know I need some
kind of null value but where do I start and where would I place it?

Ex form has id, fname, lname, address , zipcode, city, state. I would like
it to ensure we have atleast lname and address before it saves anything.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You should set up your table to have the lname and address fields'
Required properties set to "Yes." Then the user will not be able to
exit without entering something in those fields.

Read a good book about database design. I usually recommend _Database
Design for Mere Mortals_, by Hernandez.

http://tinyurl.com/kknwdq


HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSkJ0UoechKqOuFEgEQK3qgCggign68UEbw2ZD0a/Ji4kwKkc+gAAoM86
vdHMFs6mjPPSPkRzhypjdQl5
=E4SH
-----END PGP SIGNATURE-----
 
J

John W. Vinson

I have a form and many times they exit out and don't finish entering info
therefore causing blank fields and addtional records. I know I need some
kind of null value but where do I start and where would I place it?

Ex form has id, fname, lname, address , zipcode, city, state. I would like
it to ensure we have atleast lname and address before it saves anything.

Use the Form's BeforeUpdate event. Click the ... icon by the BeforeUpdate
event on the form's properties Events tab and choose Code Builder. Edit the
code to something like

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim strNag As String
If Me!Address & "" = "" Then
strNag = strNag & "Address "
End If
If Me!Zipcode & "" = "" Then
strNag = strNag & "Zipcode "
End If
<etc through the fields you want required>
If Len(strNag) > 0 Then
Cancel = True
MsgBox "Please put data into the following fields: " & strNag, vbOKOnly
End If
End Sub
 
J

John Spencer MVP

Open up the table in design view and set the fields' required property to Yes
for LName and Address. That way there is no way a record will be saved unless
those two fields have a value.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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