combo box help!!!!!!!!!

S

sbshelp

hey guys - i have a combo box - i NEED the user to enter a choice from that
combo list. how do i validate that something is input? thanks!
 
S

sbshelp

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick a value
and then erase and then trry to get to antoher box.


schasteen said:
If not isnull([comboBox]) then
..........

sbshelp said:
hey guys - i have a combo box - i NEED the user to enter a choice from that
combo list. how do i validate that something is input? thanks!
 
S

SusanV

sbs,
It's hard to say without knowing what other controls are on the form. Do you
have a "save" button? Navigation buttons? Moving to a new record or closing
the form is going to save the record automatically, so if you don't want the
user to be able to create/save a record without this control being populated
you would need to pretty much cover all of those bases, so to speak.

I have a form with a similar requirement. I removed the Close control from
the form and the navigation bar - forcing the user to use the buttons I
created to do these operations. On each button, I have code similar to the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the form open,
they will bypass all these controls, so it's still possible that you might
have a record with RequiredField not populated...


--
hth,
SusanV

sbshelp said:
schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick a value
and then erase and then trry to get to antoher box.


schasteen said:
If not isnull([comboBox]) then
..........

sbshelp said:
hey guys - i have a combo box - i NEED the user to enter a choice from
that
combo list. how do i validate that something is input? thanks!
 
S

sbshelp

hey susan - it is an input for with combo and text boxes. it has an "add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box (nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and THEN
delete that something (now blank again) - i try to click off box and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time conceptualizing
it/ thank sugys.

SusanV said:
sbs,
It's hard to say without knowing what other controls are on the form. Do you
have a "save" button? Navigation buttons? Moving to a new record or closing
the form is going to save the record automatically, so if you don't want the
user to be able to create/save a record without this control being populated
you would need to pretty much cover all of those bases, so to speak.

I have a form with a similar requirement. I removed the Close control from
the form and the navigation bar - forcing the user to use the buttons I
created to do these operations. On each button, I have code similar to the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the form open,
they will bypass all these controls, so it's still possible that you might
have a record with RequiredField not populated...


--
hth,
SusanV

sbshelp said:
schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick a value
and then erase and then trry to get to antoher box.


schasteen said:
If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a choice from
that
combo list. how do i validate that something is input? thanks!
 
S

SusanV

Yes I understand what you're saying. You see, once you select an item, then
delete it, the filed is no longer null - now it's BLANK. Which is why you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

sbshelp said:
hey susan - it is an input for with combo and text boxes. it has an "add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box (nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and THEN
delete that something (now blank again) - i try to click off box and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time conceptualizing
it/ thank sugys.

SusanV said:
sbs,
It's hard to say without knowing what other controls are on the form. Do
you
have a "save" button? Navigation buttons? Moving to a new record or
closing
the form is going to save the record automatically, so if you don't want
the
user to be able to create/save a record without this control being
populated
you would need to pretty much cover all of those bases, so to speak.

I have a form with a similar requirement. I removed the Close control
from
the form and the navigation bar - forcing the user to use the buttons I
created to do these operations. On each button, I have code similar to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the form
open,
they will bypass all these controls, so it's still possible that you
might
have a record with RequiredField not populated...


--
hth,
SusanV

sbshelp said:
schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a choice
from
that
combo list. how do i validate that something is input? thanks!
 
S

sbshelp

thanks susan - i will try but i dunno if this will work - where do i put
this code? which event?

basically i want the focus to be on it (tab) and then focus to be off (tab)
and if blank happen there.

SusanV said:
Yes I understand what you're saying. You see, once you select an item, then
delete it, the filed is no longer null - now it's BLANK. Which is why you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

sbshelp said:
hey susan - it is an input for with combo and text boxes. it has an "add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box (nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and THEN
delete that something (now blank again) - i try to click off box and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time conceptualizing
it/ thank sugys.

SusanV said:
sbs,
It's hard to say without knowing what other controls are on the form. Do
you
have a "save" button? Navigation buttons? Moving to a new record or
closing
the form is going to save the record automatically, so if you don't want
the
user to be able to create/save a record without this control being
populated
you would need to pretty much cover all of those bases, so to speak.

I have a form with a similar requirement. I removed the Close control
from
the form and the navigation bar - forcing the user to use the buttons I
created to do these operations. On each button, I have code similar to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the form
open,
they will bypass all these controls, so it's still possible that you
might
have a record with RequiredField not populated...


--
hth,
SusanV

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a choice
from
that
combo list. how do i validate that something is input? thanks!
 
S

SusanV

You lost me with the focus piece?

sbshelp said:
thanks susan - i will try but i dunno if this will work - where do i put
this code? which event?

basically i want the focus to be on it (tab) and then focus to be off
(tab)
and if blank happen there.

SusanV said:
Yes I understand what you're saying. You see, once you select an item,
then
delete it, the filed is no longer null - now it's BLANK. Which is why you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

sbshelp said:
hey susan - it is an input for with combo and text boxes. it has an
"add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box
(nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and
THEN
delete that something (now blank again) - i try to click off box and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time
conceptualizing
it/ thank sugys.

:

sbs,
It's hard to say without knowing what other controls are on the form.
Do
you
have a "save" button? Navigation buttons? Moving to a new record or
closing
the form is going to save the record automatically, so if you don't
want
the
user to be able to create/save a record without this control being
populated
you would need to pretty much cover all of those bases, so to speak.

I have a form with a similar requirement. I removed the Close control
from
the form and the navigation bar - forcing the user to use the buttons
I
created to do these operations. On each button, I have code similar to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the form
open,
they will bypass all these controls, so it's still possible that you
might
have a record with RequiredField not populated...


--
hth,
SusanV

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a choice
from
that
combo list. how do i validate that something is input? thanks!
 
S

sbshelp

sorry! :)

well the tab order(first)is set to this combo box. the box is blank until
you click on drop down and pick. if you do not click on drop down and leave
it blank - you can tab (off focus) without getting a "NEED DATA ENTRY"
message.

i need taht combo box to be populated every time a person creates a record.

which event do i use? what code?

thanks guys!
:)


SusanV said:
You lost me with the focus piece?

sbshelp said:
thanks susan - i will try but i dunno if this will work - where do i put
this code? which event?

basically i want the focus to be on it (tab) and then focus to be off
(tab)
and if blank happen there.

SusanV said:
Yes I understand what you're saying. You see, once you select an item,
then
delete it, the filed is no longer null - now it's BLANK. Which is why you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

hey susan - it is an input for with combo and text boxes. it has an
"add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box
(nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and
THEN
delete that something (now blank again) - i try to click off box and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time
conceptualizing
it/ thank sugys.

:

sbs,
It's hard to say without knowing what other controls are on the form.
Do
you
have a "save" button? Navigation buttons? Moving to a new record or
closing
the form is going to save the record automatically, so if you don't
want
the
user to be able to create/save a record without this control being
populated
you would need to pretty much cover all of those bases, so to speak.

I have a form with a similar requirement. I removed the Close control
from
the form and the navigation bar - forcing the user to use the buttons
I
created to do these operations. On each button, I have code similar to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the form
open,
they will bypass all these controls, so it's still possible that you
might
have a record with RequiredField not populated...


--
hth,
SusanV

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a choice
from
that
combo list. how do i validate that something is input? thanks!
 
S

SusanV

Oh ok - gotcha!! Use the control's LostFocus Event:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must select whatever this is for"
Me.RequiredField.SetFocus
End If


Now if the user tabs or clicks to a different control or otherwise moves off
the control without selecting (or selecting then clearing) they will get a
popup "slap on the wrist" and the focus will return to the required control.
If the control is populated, then nothing happens - the user can continue on
to the next field.

Let me know if that works for you!

SusanV



sbshelp said:
sorry! :)

well the tab order(first)is set to this combo box. the box is blank until
you click on drop down and pick. if you do not click on drop down and
leave
it blank - you can tab (off focus) without getting a "NEED DATA ENTRY"
message.

i need taht combo box to be populated every time a person creates a
record.

which event do i use? what code?

thanks guys!
:)


SusanV said:
You lost me with the focus piece?

sbshelp said:
thanks susan - i will try but i dunno if this will work - where do i
put
this code? which event?

basically i want the focus to be on it (tab) and then focus to be off
(tab)
and if blank happen there.

:

Yes I understand what you're saying. You see, once you select an item,
then
delete it, the filed is no longer null - now it's BLANK. Which is why
you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

hey susan - it is an input for with combo and text boxes. it has an
"add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box
(nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and
THEN
delete that something (now blank again) - i try to click off box and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time
conceptualizing
it/ thank sugys.

:

sbs,
It's hard to say without knowing what other controls are on the
form.
Do
you
have a "save" button? Navigation buttons? Moving to a new record or
closing
the form is going to save the record automatically, so if you don't
want
the
user to be able to create/save a record without this control being
populated
you would need to pretty much cover all of those bases, so to
speak.

I have a form with a similar requirement. I removed the Close
control
from
the form and the navigation bar - forcing the user to use the
buttons
I
created to do these operations. On each button, I have code similar
to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the
form
open,
they will bypass all these controls, so it's still possible that
you
might
have a record with RequiredField not populated...


--
hth,
SusanV

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick
a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a
choice
from
that
combo list. how do i validate that something is input?
thanks!
 
S

sbshelp

susan - you rock! works awesomely but once i hit the ok on message button
the focus is on the next combo so it doesnt go back to original-i will messa
around with setfocus event.

thanks!!!!!!!!

:*********************

SusanV said:
Oh ok - gotcha!! Use the control's LostFocus Event:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must select whatever this is for"
Me.RequiredField.SetFocus
End If


Now if the user tabs or clicks to a different control or otherwise moves off
the control without selecting (or selecting then clearing) they will get a
popup "slap on the wrist" and the focus will return to the required control.
If the control is populated, then nothing happens - the user can continue on
to the next field.

Let me know if that works for you!

SusanV



sbshelp said:
sorry! :)

well the tab order(first)is set to this combo box. the box is blank until
you click on drop down and pick. if you do not click on drop down and
leave
it blank - you can tab (off focus) without getting a "NEED DATA ENTRY"
message.

i need taht combo box to be populated every time a person creates a
record.

which event do i use? what code?

thanks guys!
:)


SusanV said:
You lost me with the focus piece?


thanks susan - i will try but i dunno if this will work - where do i
put
this code? which event?

basically i want the focus to be on it (tab) and then focus to be off
(tab)
and if blank happen there.

:

Yes I understand what you're saying. You see, once you select an item,
then
delete it, the filed is no longer null - now it's BLANK. Which is why
you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

hey susan - it is an input for with combo and text boxes. it has an
"add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box
(nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and
THEN
delete that something (now blank again) - i try to click off box and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time
conceptualizing
it/ thank sugys.

:

sbs,
It's hard to say without knowing what other controls are on the
form.
Do
you
have a "save" button? Navigation buttons? Moving to a new record or
closing
the form is going to save the record automatically, so if you don't
want
the
user to be able to create/save a record without this control being
populated
you would need to pretty much cover all of those bases, so to
speak.

I have a form with a similar requirement. I removed the Close
control
from
the form and the navigation bar - forcing the user to use the
buttons
I
created to do these operations. On each button, I have code similar
to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the
form
open,
they will bypass all these controls, so it's still possible that
you
might
have a record with RequiredField not populated...


--
hth,
SusanV

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you pick
a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a
choice
from
that
combo list. how do i validate that something is input?
thanks!
 
S

SusanV

Oh one other thing - if you *really* want to be able to control user input,
you're going to need to setfocus right through all these required controls -
as they may not tab, but rather use the mouse to click on a control out of
order.

In the Form's OnCurrent Event:

Me.FirstRequiredControl.SetFocus




Then on each consecutive required control, use the code I supplied in my
last post EXCEPT using and Else:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must select whatever this is for"
Me.RequiredField.SetFocus
Else
Me.NextRequiredField.SetFocus
End If


And no, I don't consider myself a control freak! I just HATE when users find
a way around my code and break my data!
;-D



SusanV said:
Oh ok - gotcha!! Use the control's LostFocus Event:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must select whatever this is for"
Me.RequiredField.SetFocus
End If


Now if the user tabs or clicks to a different control or otherwise moves
off the control without selecting (or selecting then clearing) they will
get a popup "slap on the wrist" and the focus will return to the required
control. If the control is populated, then nothing happens - the user can
continue on to the next field.

Let me know if that works for you!

SusanV



sbshelp said:
sorry! :)

well the tab order(first)is set to this combo box. the box is blank
until
you click on drop down and pick. if you do not click on drop down and
leave
it blank - you can tab (off focus) without getting a "NEED DATA ENTRY"
message.

i need taht combo box to be populated every time a person creates a
record.

which event do i use? what code?

thanks guys!
:)


SusanV said:
You lost me with the focus piece?


thanks susan - i will try but i dunno if this will work - where do i
put
this code? which event?

basically i want the focus to be on it (tab) and then focus to be off
(tab)
and if blank happen there.

:

Yes I understand what you're saying. You see, once you select an
item,
then
delete it, the filed is no longer null - now it's BLANK. Which is why
you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

hey susan - it is an input for with combo and text boxes. it has
an
"add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box
(nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and
THEN
delete that something (now blank again) - i try to click off box
and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time
conceptualizing
it/ thank sugys.

:

sbs,
It's hard to say without knowing what other controls are on the
form.
Do
you
have a "save" button? Navigation buttons? Moving to a new record
or
closing
the form is going to save the record automatically, so if you
don't
want
the
user to be able to create/save a record without this control being
populated
you would need to pretty much cover all of those bases, so to
speak.

I have a form with a similar requirement. I removed the Close
control
from
the form and the navigation bar - forcing the user to use the
buttons
I
created to do these operations. On each button, I have code
similar to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the
form
open,
they will bypass all these controls, so it's still possible that
you
might
have a record with RequiredField not populated...


--
hth,
SusanV

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you
pick a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a
choice
from
that
combo list. how do i validate that something is input?
thanks!
 
S

SusanV

Glad to help - Let me know how you make out!

sbshelp said:
susan - you rock! works awesomely but once i hit the ok on message button
the focus is on the next combo so it doesnt go back to original-i will
messa
around with setfocus event.

thanks!!!!!!!!

:*********************

SusanV said:
Oh ok - gotcha!! Use the control's LostFocus Event:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must select whatever this is for"
Me.RequiredField.SetFocus
End If


Now if the user tabs or clicks to a different control or otherwise moves
off
the control without selecting (or selecting then clearing) they will get
a
popup "slap on the wrist" and the focus will return to the required
control.
If the control is populated, then nothing happens - the user can continue
on
to the next field.

Let me know if that works for you!

SusanV



sbshelp said:
sorry! :)

well the tab order(first)is set to this combo box. the box is blank
until
you click on drop down and pick. if you do not click on drop down and
leave
it blank - you can tab (off focus) without getting a "NEED DATA ENTRY"
message.

i need taht combo box to be populated every time a person creates a
record.

which event do i use? what code?

thanks guys!
:)


:

You lost me with the focus piece?


thanks susan - i will try but i dunno if this will work - where do i
put
this code? which event?

basically i want the focus to be on it (tab) and then focus to be
off
(tab)
and if blank happen there.

:

Yes I understand what you're saying. You see, once you select an
item,
then
delete it, the filed is no longer null - now it's BLANK. Which is
why
you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

hey susan - it is an input for with combo and text boxes. it has
an
"add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box
(nothing
shows) and then click off - it doesnt prompt me to input
something.

BUT when i click on combo boc and then pick something from list
and
THEN
delete that something (now blank again) - i try to click off box
and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time
conceptualizing
it/ thank sugys.

:

sbs,
It's hard to say without knowing what other controls are on the
form.
Do
you
have a "save" button? Navigation buttons? Moving to a new record
or
closing
the form is going to save the record automatically, so if you
don't
want
the
user to be able to create/save a record without this control
being
populated
you would need to pretty much cover all of those bases, so to
speak.

I have a form with a similar requirement. I removed the Close
control
from
the form and the navigation bar - forcing the user to use the
buttons
I
created to do these operations. On each button, I have code
similar
to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the
form
open,
they will bypass all these controls, so it's still possible that
you
might
have a record with RequiredField not populated...


--
hth,
SusanV

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you
pick
a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a
choice
from
that
combo list. how do i validate that something is input?
thanks!
 
S

sbshelp

susan- i am going to use that code you sent - one thing tho

the set focus is not setting to where i say!

me(which is for).msg(which is combo box control).setfocus.

wonder why!?



SusanV said:
Oh one other thing - if you *really* want to be able to control user input,
you're going to need to setfocus right through all these required controls -
as they may not tab, but rather use the mouse to click on a control out of
order.

In the Form's OnCurrent Event:

Me.FirstRequiredControl.SetFocus




Then on each consecutive required control, use the code I supplied in my
last post EXCEPT using and Else:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must select whatever this is for"
Me.RequiredField.SetFocus
Else
Me.NextRequiredField.SetFocus
End If


And no, I don't consider myself a control freak! I just HATE when users find
a way around my code and break my data!
;-D



SusanV said:
Oh ok - gotcha!! Use the control's LostFocus Event:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must select whatever this is for"
Me.RequiredField.SetFocus
End If


Now if the user tabs or clicks to a different control or otherwise moves
off the control without selecting (or selecting then clearing) they will
get a popup "slap on the wrist" and the focus will return to the required
control. If the control is populated, then nothing happens - the user can
continue on to the next field.

Let me know if that works for you!

SusanV



sbshelp said:
sorry! :)

well the tab order(first)is set to this combo box. the box is blank
until
you click on drop down and pick. if you do not click on drop down and
leave
it blank - you can tab (off focus) without getting a "NEED DATA ENTRY"
message.

i need taht combo box to be populated every time a person creates a
record.

which event do i use? what code?

thanks guys!
:)


:

You lost me with the focus piece?


thanks susan - i will try but i dunno if this will work - where do i
put
this code? which event?

basically i want the focus to be on it (tab) and then focus to be off
(tab)
and if blank happen there.

:

Yes I understand what you're saying. You see, once you select an
item,
then
delete it, the filed is no longer null - now it's BLANK. Which is why
you
need the OR in the if statement:

If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then



Or, if you want to go the other way and test for NOT null or blank:

If NOT IsNull(Me.RequiredField) OR Me.RequiredField <> "" Then

Hope that's a bit clearer...


SusanV

hey susan - it is an input for with combo and text boxes. it has
an
"add
record" button and "refresh" button and "close form" button.

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

-
the result is - when i open the form and the click on combo box
(nothing
shows) and then click off - it doesnt prompt me to input something.

BUT when i click on combo boc and then pick something from list and
THEN
delete that something (now blank again) - i try to click off box
and
validation text comes up saying to populate.

does this help? i am sure it is easy but having hard time
conceptualizing
it/ thank sugys.

:

sbs,
It's hard to say without knowing what other controls are on the
form.
Do
you
have a "save" button? Navigation buttons? Moving to a new record
or
closing
the form is going to save the record automatically, so if you
don't
want
the
user to be able to create/save a record without this control being
populated
you would need to pretty much cover all of those bases, so to
speak.

I have a form with a similar requirement. I removed the Close
control
from
the form and the navigation bar - forcing the user to use the
buttons
I
created to do these operations. On each button, I have code
similar to
the
following:

Sub btn_Click
If IsNull(Me.RequiredField) OR Me.RequiredField = "" Then
MsgBox "You must choose an option in RequiredField!"
Exit Sub
Else
'Do whatever the button is meant to do - save, next, etc
End If

End Sub

Keep in mind, however, that if they close Access itself with the
form
open,
they will bypass all these controls, so it's still possible that
you
might
have a record with RequiredField not populated...


--
hth,
SusanV

schas - i am not sure what you mean and where to put it.
is null in the validation section of box works ONLY when you
pick a
value
and then erase and then trry to get to antoher box.


:

If not isnull([comboBox]) then
..........

:

hey guys - i have a combo box - i NEED the user to enter a
choice
from
that
combo list. how do i validate that something is input?
thanks!
 
J

John Vinson

there are about 8 combo boxes that NEED to be populated.
in the validation part of the combo boxes i put
Is Not Null

That only helps if the user actually does something with the combo. It
doesn't force them to touch the combo at all.
the result is - when i open the form and the click on combo box (nothing
shows) and then click off - it doesnt prompt me to input something.

Either make the fields Required in table design, or (better, since you
can more easily control the error message) use the Form's BeforeUpdate
event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me!cboThis) Then
MsgBox "Please select a THIS", vbOKOnly
Me!cboThis.SetFocus
Cancel = True
Exit Sub
End If
If IsNull(Me!cboThat) Then
MsgBox "Please select a THAT", vbOKOnly
Me!cboThat.SetFocus
Cancel = True
Exit Sub
End If
End Sub

John W. Vinson[MVP]
 
S

sbshelp

thanks john susans worked but it seems that i cannot get the focus back on
the combo box after the msgbox appears and i click.
it goes to next tab stop.
 
Top