473,387 Members | 1,703 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,387 software developers and data experts.

How to ensure each field in a form is filled up?

kev
Hi all,

i would like to know how can we ensure that a user fill in each field
in a form?
How do we create a warning message of a sort" Please fill in the
details"
I hope to get a detailed answer plus coding if there is any.

Thanks in advance.

Dec 8 '06 #1
6 2954
"kev" <ke******@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
Hi all,

i would like to know how can we ensure that a user fill in each field
in a form?
How do we create a warning message of a sort" Please fill in the
details"
I hope to get a detailed answer plus coding if there is any.

Thanks in advance.
You could code it but the easiest way is to make your fields "required" at
table level, no code required at all.

HTH - Keith.
www.keithwilby.com
Dec 8 '06 #2
kev
Hi Keith,

I did make the Required property set to Yes.
However, the warning message displayed is not so user friendly as it
says "Microsoft acess requires this field..."
I would like it to be a statement that could be understood by all
level. eg 'Please enter a name".

Secondly,
The method you suggested only works at the end of the form when you are
about to save it, then only does the message appear.
What i want is when user move from one field to another without any
inputs i want the warning msg to appear. sort of like there is a
message for each field.

hope you could give me a reply fast (*pls include coding if there is
any)

million of thanks

Keith Wilby wrote:
"kev" <ke******@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
Hi all,

i would like to know how can we ensure that a user fill in each field
in a form?
How do we create a warning message of a sort" Please fill in the
details"
I hope to get a detailed answer plus coding if there is any.

Thanks in advance.

You could code it but the easiest way is to make your fields "required" at
table level, no code required at all.

HTH - Keith.
www.keithwilby.com
Dec 8 '06 #3
"kev" <ke******@gmail.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.com...
Hi Keith,

I did make the Required property set to Yes.
However, the warning message displayed is not so user friendly as it
says "Microsoft acess requires this field..."
I would like it to be a statement that could be understood by all
level. eg 'Please enter a name".

Secondly,
The method you suggested only works at the end of the form when you are
about to save it, then only does the message appear.
What i want is when user move from one field to another without any
inputs i want the warning msg to appear. sort of like there is a
message for each field.
In that case what you could use is a public function to which you can pass
the control name, and call the function from the control's "lost focus"
event. This is untested air code:

Public Function libInputData(strControlName As String)

Dim strLegend As String
strLegend = "Please enter some data in the "
If strControlName = "txtMyTextBox" Then
strLegend = strLegend & "field name"
ElseIf strControlName = "whatever" Then ' ... and so on for all of your
controls.
Else
'Do something else if required
End If

strLegend =strLegend & " field."
MsgBox strLegend

End Function

You'd then call the function from a control's lost focus event supplying the
name argument:

Call libInputData(Me.txtMyTextBox.Name)

This is a quick and dirty solution to get you started but you could get a
bit smarter in slow time by looping through your controls instead if using
If ... Then.

HTH - Keith.
Dec 8 '06 #4
You have to code in two places (at least):-
The lostfocus event for the control, so you can pick up if the control
has any data in it and stop the user progressing if it doesn't

and (because users can use the mouse to skip controls)
The beforeupdate event of the form, where you need to cycle through all
the controls to check that hey are all completed.

--

Terry Kreft
"kev" <ke******@gmail.comwrote in message
news:11*********************@79g2000cws.googlegrou ps.com...
Hi Keith,

I did make the Required property set to Yes.
However, the warning message displayed is not so user friendly as it
says "Microsoft acess requires this field..."
I would like it to be a statement that could be understood by all
level. eg 'Please enter a name".

Secondly,
The method you suggested only works at the end of the form when you are
about to save it, then only does the message appear.
What i want is when user move from one field to another without any
inputs i want the warning msg to appear. sort of like there is a
message for each field.

hope you could give me a reply fast (*pls include coding if there is
any)

million of thanks

Keith Wilby wrote:
"kev" <ke******@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
Hi all,
>
i would like to know how can we ensure that a user fill in each field
in a form?
How do we create a warning message of a sort" Please fill in the
details"
I hope to get a detailed answer plus coding if there is any.
>
Thanks in advance.
>
You could code it but the easiest way is to make your fields "required"
at
table level, no code required at all.

HTH - Keith.
www.keithwilby.com

Dec 8 '06 #5
"Terry Kreft" wrote
You have to code in two places (at least):-
The lostfocus event for the control, so you can pick up if the control
has any data in it and stop the user progressing if it doesn't
This would be rather "user-unfriendly" if the user just happened to click in
a Control for which he/she was waiting for a phone call with the data for
that Field, but could otherwise continue filling in the rest of the Controls
on the Form. I would not restrict the user in that way... just put the check
in the Form's BeforeUpdate event.

In fact, I worked on a subcontract where the application architect (and
prime contractor) thought that the users ought to be able to enter the data
in as many sessions as they wished. The users seemed to like that
flexibility, but it did, on occasion, cause some strange results to appear
on summaries and reports.

Larry Linson
Microsoft Access MVP
Dec 9 '06 #6
I would normally check any data entered using the beforeupdate event of the
control and then the whole record in the beforeupdate event of the form but
as the OP specifically wanted to check the input as the user advanced
through the form and prevent them from skipping fields, that was the
question I answered.

--

Terry Kreft
"Larry Linson" <bo*****@localhost.notwrote in message
news:9poeh.120$HX4.55@trnddc03...
"Terry Kreft" wrote
You have to code in two places (at least):-
The lostfocus event for the control, so you can pick up if the
control
has any data in it and stop the user progressing if it doesn't

This would be rather "user-unfriendly" if the user just happened to click
in
a Control for which he/she was waiting for a phone call with the data for
that Field, but could otherwise continue filling in the rest of the
Controls
on the Form. I would not restrict the user in that way... just put the
check
in the Form's BeforeUpdate event.

In fact, I worked on a subcontract where the application architect (and
prime contractor) thought that the users ought to be able to enter the
data
in as many sessions as they wished. The users seemed to like that
flexibility, but it did, on occasion, cause some strange results to appear
on summaries and reports.

Larry Linson
Microsoft Access MVP


Dec 11 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: TekWiz | last post by:
I've got a system that automatically generates a form. I have it set up so that the backend will return to the inital form page with an error object in sessions data (assuming the backend detected...
1
by: Newbie | last post by:
OK, this may be impossible since I'm using 3rd party shopping cart ASP software, but I've been able to finagle a lot of other stuff I thought wouldn't work, so here we go: I'm using a form in...
2
by: Meredith | last post by:
I am using a script to validate a form using the presence of a value in one field and determine if there is a value in one of two fields. It is an either/or situation. If the date rcvd field is...
1
by: Old Timer | last post by:
I wish to type in a number in my "Code" field, for instance 1060, I then wish the number 1060 to trigger an event that will fill in the next field (township field) For instance, 1060 brings up and...
1
by: Frankie | last post by:
Hi, In my form users must enter data about new employees. One of the fields is the birthdate of an employee. The next field is a registration number that looks like this: 0YYMMDD. 0: first...
2
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
7
by: grummanf6f | last post by:
Hello Gurus, this probably is real simple for you but for me it's a bummer. I have one table in which I have basic data collected of schools. I have another data that is detailed info on the...
1
by: AA Arens | last post by:
I do have two forms. One to add CompanyName and PhoneNumber in a table tblCompany On the 2nd form to fill in the remaining info. With a combo box I choose a CompanyName I added with in 1st form....
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.