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

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Data in only one textbox    
 
   
mattbrem
post Feb 10 2009, 08:40 AM
Post #1

UtterAccess Addict
Posts: 127



If I have a form with multiple textboxes (unbound) is there an easy way to check that the user only entered data in a single text box before clicking a button?
Go to the top of the page
 
+
Peter46
post Feb 10 2009, 08:47 AM
Post #2

UtterAccess VIP
Posts: 7,400
From: Oadby Leics, UK



Depends on what you class as easy.

You create a procedure which checks that a max of one box contains data and you run that procedure in the afterupdate event procedure of each textbox.

For example(assumes you are expecting text values:

sub checkmax1()
Dim Kount
If nz(me.textbox1,"")>"" then Kount=kount+1
If nz(me.textbox2,"")>"" then Kount=kount+1
If nz(me.textbox3,"")>"" then Kount=kount+1
if Kount >1 then msgbox "Too many boxes filled"
end sub
Go to the top of the page
 
+
mattbrem
post Feb 10 2009, 09:21 AM
Post #3

UtterAccess Addict
Posts: 127



That was easy enough, thanks!
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: 26th May 2013 - 03:34 AM