UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Required fields    
 
   
docmiller10
post Dec 3 2004, 03:52 PM
Post #1

UtterAccess Addict
Posts: 172



I have a form that a user opens to add a new record to the database. I want to make certain fields required data. Is there an easy way to do this, or do I have to do the

If txtfield1 is null then
Msgbox "This is a required field"
txtfield1.setfocus
end if


routine when they try to save the record?
Go to the top of the page
 
+
Matt_M
post Dec 3 2004, 04:02 PM
Post #2

New Member
Posts: 14
From: San Diego



Check out this link in the Code Archive. It worked well for me.

Required Fields
Go to the top of the page
 
+
quest4
post Dec 3 2004, 04:03 PM
Post #3

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



Is is Me!txtfield1 and I personally like that way it is one of the better to check. If you check the data from several different point, like cmdButtons, or have the same data on everal different form then use a function to do this. hth.
Go to the top of the page
 
+
docmiller10
post Dec 3 2004, 04:08 PM
Post #4

UtterAccess Addict
Posts: 172



Thanks all. When I tried to open the second demo database, I get a read-only message and the database doesn't open. Is this normal?
Go to the top of the page
 
+
quest4
post Dec 3 2004, 04:10 PM
Post #5

UtterAccess Ruler
Posts: 1,884
From: Cleveland, OH



Try holding down the shift button when open it. hth.
Go to the top of the page
 
+
Matt_M
post Dec 3 2004, 04:11 PM
Post #6

New Member
Posts: 14
From: San Diego



I'm not sure, I used the first attachment as I have Access 2003.
Go to the top of the page
 
+
docmiller10
post Dec 3 2004, 04:13 PM
Post #7

UtterAccess Addict
Posts: 172



I have Access 2000 and the shift key suggestion does not work either, but thanks for the info anyway!
Go to the top of the page
 
+
docmiller10
post Dec 3 2004, 04:14 PM
Post #8

UtterAccess Addict
Posts: 172



Oops I found another problem. One of the fields I have formatted as short date. If no value is input in this field, I get a Type Mismatch error. This prevents my required field checks from running when the Save Record button is clicked. How do I get around this?
Go to the top of the page
 
+
Matt_M
post Dec 3 2004, 04:18 PM
Post #9

New Member
Posts: 14
From: San Diego



I generally don't allow date fields to be null (when I can help it) and use a default of Now(). If it is a requirement to leave the possibility of a null, I'm not sure.
Go to the top of the page
 
+
docmiller10
post Dec 3 2004, 04:22 PM
Post #10

UtterAccess Addict
Posts: 172



This is a form that tracks various job phases, so some of the date information is not available when the initial entry is made. Using a default date field will cause reporting problems.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 25th May 2013 - 10:17 PM