My Assistant
![]() ![]() |
|
|
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?
|
|
|
|
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 |
|
|
|
Feb 10 2009, 09:21 AM
Post
#3
|
|
|
UtterAccess Addict Posts: 127 |
That was easy enough, thanks!
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 26th May 2013 - 03:34 AM |