473,396 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to make sure to provide data in all controls on a form

16
how to make sure that data in all controls on a form including tabs is provided before moving to next record?? Hope someone will find time to answer :)
Thanks
Nov 19 '15 #1
4 1319
mbizup
80 64KB
You can use the before update event to check your controls, and cancel the event if your validation checks fail. Note that controls in tabs are handled the same way as those outside of the tab control (unless any of the controls happen to be in sub forms):

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel as integer)
  2.    dim blCancelUpdate as boolean
  3.    if me.txtMytextbox & "" = "" then blCancelUpdate =true
  4.    if me.cboMyCombo & "" = "" then blCancelUpdate =true
  5.    'etc
  6.    if blCancelUpdate =true then
  7.       Msgbox "Please fill in all data"
  8.       Cancel = true
  9.    end if
  10. end sub
You may also be able to do this more generically:


Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel as integer)
  2.    dim blCancelUpdate as Boolean
  3.    dim ctl as control
  4.    for each ctl in me.controls
  5.     if ctl.controltype = actextbox or ctl.controltype = accombobox then 
  6.       if ctl & "" = "" then blCancelUpdate =true
  7.    end if
  8.    if blCancelUpdate =true then
  9.       Msgbox "Please fill in all data"
  10.       Cancel = true
  11.    end if
  12. end sub
Nov 19 '15 #2
RaoAli
16
thank you for the reply. in addition to this could you please suggest some way to move focus from control on main form to the controls on Tab Control and similarly from last control of tab to first control of next tab and so on.

thank you once again.
Nov 22 '15 #3
zmbd
5,501 Expert Mod 4TB
see my post here:
https://bytes.com/topic/access/answe...ox#post3798634

Should do all you have asked for
Nov 22 '15 #4
NeoPa
32,556 Expert Mod 16PB
In its simplest form you just need to ensure the tables are designed such that all mandatory fields are set as such.

Some people have more complex requirements, but for your specific question that is all you need.
Nov 22 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Vik | last post by:
I use the same dataadapters and datasets on a few aspx pages. Currently I create these data controls on each page. Is it possible to create these controls only once and then use them on the...
4
by: Murali Krishna. Siruvuru | last post by:
Hi, All of a sudden, all my Button Controls and Image Button Controls are not posting back data. I have Click event and event handlers in the code. Page itself is not posting back. Whereas...
5
by: Aspnot | last post by:
Background: I have a data entry form that is bound to a DataSet. This DataSet contains 9 tables and the form displays data from each table in textboxes, not a DataGrid. One of the tables in the...
2
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the...
1
by: Dino Buljubasic | last post by:
Hi, I am using VS2005 (C#) and SQL Server 2000. How can I make sure that: 1. Client A queries info from database and displays it in a list view or other controls on a form. If Client B...
6
by: divya | last post by:
I have a page name edit.asp which should expire immediately .The user cannot open this page directly he has to provide a password for entering this page.thus when the user enters edit.asp , it has...
1
by: Richard | last post by:
Very typical normal data Table One ------ One.OneID (PK) One.Name One.Description One.TwoID (FK) One.ThreeID (FK) ....
2
by: keisha | last post by:
I have a access database. I have a form that as a field that i need to check to make sure is not been duplicated. Possible validation required? The field data type is number so the user have to input...
4
by: banderson | last post by:
Hello, I am having a problem getting a new record in a subform to append to the underlying table. When I add a new record to the main form, the subform is blank, except for the ID field, which is...
6
by: SAL | last post by:
Hi, VS2005 post I'm opening a window using the following syntax: Protected Sub lbEstValue_Click(ByVal sender As Object, ByVal e As System.EventArgs)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.