By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,705 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,705 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
"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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
"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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.