Need to trap required field of combo box

G

Guest

I have a form with combo box BidderNo to select a bidder number from list (or
typed in). In the table the field is set to "Required" however the error
isn't activated until you attempt to exit the form. What I need is:

1. User cannot move beyond this field if it is blank. I would like an
error message that says "Please enter a Bidder Number!"
-and/or-
2. User cannot move beyond this field if the number is less than 500. I
would like an error message that says "This is not a valid Bidder Number!"

I understand case statements and such, but I am unsure in which Property to
put the event proc, and also once the conditions are met, how you continue
through the form.

Am I clear as mud??

Thanks,

Sandra G
 
J

John Vinson

I have a form with combo box BidderNo to select a bidder number from list (or
typed in). In the table the field is set to "Required" however the error
isn't activated until you attempt to exit the form. What I need is:

1. User cannot move beyond this field if it is blank. I would like an
error message that says "Please enter a Bidder Number!"
-and/or-
2. User cannot move beyond this field if the number is less than 500. I
would like an error message that says "This is not a valid Bidder Number!"

I understand case statements and such, but I am unsure in which Property to
put the event proc, and also once the conditions are met, how you continue
through the form.

Am I clear as mud??

Well, you're posing some real difficulties here. The Windows paradigm
implies that a user can use the mouse or the tab key to move at will
around the form, and fill in controls in any order they wish.

My suggestion would be to put a friendlier warning message in the
Form's BeforeUpdate event: e.g.

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me!BidderNo) Then
MsgBox "Please enter a bidder number!"
Cancel = True
Me!BidderNo.SetFocus
End If
If Me!BidderNo < 500 Then
<< you get the idea >>


If you REALLY want the user to stop, and not fill out any other
controls until the combo is selected, then you'll need to have all the
other controls' Enabled property set to False - they'll be greyed out,
and cannot be selected or used. You can set Enabled to True in the
afterupdate event of BidderNo (and back to False in the form's
BeforeInsert event). This is more complex and (in my opinion) hard on
the user - they might have the information for six or eight other
controls right handy, and the bidder number coming when a colleague
returns a phone call. Let them enter what they have!

John W. Vinson[MVP]
 
G

Guest

Yes I understand your method and perhaps there is a better way to accomplish
what I need. The problem I have is that I have a form with an unbound combo
box which graps a list of bidder numbers. Within this form is a continuous
subform that allows entries for auction items purchased by the bidder. So,
what's happening now is that the user may forget to put in the bidder number
and goes to the subform and fills out those records. After all these entries
are made and you attempt to exit the form, then the error message comes up
about the required combo field. In order to get rid of this message you have
to delete the items you just entered. Access won't allow you out of this
message until you have deleted the items that you just put in so that you can
get back up to the combo box to put in the number. This seems very awkward
and confuses my input people. I would like to stop this at the beginning by
making sure the first field is valid before entering a bunch of work that may
get blitzed out and redone.

All our data comes complete with the bid sheet so it includes the Bidder
Number and the items he bid on. In otherwords, there would not be any
missing information by the time it gets to us. All I want to do is prevent
data entry into the other fields and subforms until this key field has been
validated.

Thanks,
Sandra G
 
R

Rick Brandt

Sandra said:
Yes I understand your method and perhaps there is a better way to
accomplish what I need. The problem I have is that I have a form
with an unbound combo box which graps a list of bidder numbers.
Within this form is a continuous subform that allows entries for
auction items purchased by the bidder. So, what's happening now is
that the user may forget to put in the bidder number and goes to the
subform and fills out those records. [snip]

You can hide or disable the subform and use the AfterUpdate event of the
ComboBox to show or enable it. That will make it very obvious that the ComboBox
entry has to be made first.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top