Can I make a field 'required' on the form level and not thru the table level?
StacyStacy A "Californian" at heart! Local time Today, 01:16 Joined Jan 29, 2003 Messages 159 Jun 11, 2003 #1 Can I make a field 'required' on the form level and not thru the table level?
Robert Dunstan Mr Data Local time Today, 07:16 Joined Jun 22, 2000 Messages 291 Jun 11, 2003 #2 Yes you can by placing some code in your form's BeforeUpdate event. For example PHP:Copy to clipboard If IsNull(myControlName) Then MsgBox "Please enter something!", vbCritical, "Required Entry" myControlName.Setfocus Cancel = True End If This will test for a null, however if you have set at table level 'Allow zero length strings' to yes, then you'll need to also use the Nz function HTH Rob
Yes you can by placing some code in your form's BeforeUpdate event. For example PHP:Copy to clipboard If IsNull(myControlName) Then MsgBox "Please enter something!", vbCritical, "Required Entry" myControlName.Setfocus Cancel = True End If This will test for a null, however if you have set at table level 'Allow zero length strings' to yes, then you'll need to also use the Nz function HTH Rob
R rhett7660 Still Learning.... Local time Yesterday, 23:16 Joined Aug 25, 2005 Messages 371 Jun 26, 2010 #3 Re: Requied Field on a Form How would you set it up if you have say 5 txtboxes and 3cbo boxes that you want to make sure something is filled in? I have tried the , and the word and and I can't get it to work. ***EDIT*** I figured it out... Just use a couple more IF statements. Last edited: Jun 26, 2010
Re: Requied Field on a Form How would you set it up if you have say 5 txtboxes and 3cbo boxes that you want to make sure something is filled in? I have tried the , and the word and and I can't get it to work. ***EDIT*** I figured it out... Just use a couple more IF statements.
C CEH Curtis Local time Today, 01:16 Joined Oct 22, 2004 Messages 1,187 Jun 29, 2010 #4 Re: Requied Field on a Form Or use the "tag" property.