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

Clear a combo box on error?

P: n/a
I have a combo box that searches for records in the database. When a
name is typed in that is not in the database, Access shows a message
box that says,

The test you entered isn't an item in the list.
with an "OK" button.

Is there a way to get it to clear the text that has been typed in, or
highlight it when the "OK" button is clicked?

Thanks for any help
Jan 19 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Yes, use the NotInList event of the combo box.

Example:
Msgbox "You typed an item that isn't in the list. Please try again."
Response = acDataErrContinue
Me.cboMyCombo = Null

--
Wayne Morgan
MS Access MVP
"Shyguy" <sh****@aol.com> wrote in message
news:81********************************@4ax.com...
I have a combo box that searches for records in the database. When a
name is typed in that is not in the database, Access shows a message
box that says,

The test you entered isn't an item in the list.
with an "OK" button.

Is there a way to get it to clear the text that has been typed in, or
highlight it when the "OK" button is clicked?

Thanks for any help

Jan 19 '06 #2

P: n/a
Thank you so much. I've been beating my head against the wall and I
doubt if I would have ever figured that out.

Is there a way to get the message box to center on the form rather
than the screen?

On Thu, 19 Jan 2006 19:16:56 GMT, "Wayne Morgan"
<co***************************@hotmail.com> wrote:
Msgbox "You typed an item that isn't in the list. Please try again."
Response = acDataErrContinue
Me.cboMyCombo = Null


Jan 19 '06 #3

P: n/a
> Is there a way to get the message box to center on the form rather
than the screen?
Not that I know of. Instead of a MsgBox, you could create a form that looks
like a message box and place it where you want it. If you do, open this form
with the acDialog window mode argument of the DoCmd.OpenForm call.

--
Wayne Morgan
MS Access MVP
"Shyguy" <sh****@aol.com> wrote in message
news:bn********************************@4ax.com... Thank you so much. I've been beating my head against the wall and I
doubt if I would have ever figured that out.

Is there a way to get the message box to center on the form rather
than the screen?

Jan 19 '06 #4

P: n/a
Thanks again for the help. I think I'll leave it this way. I like
the way it works and "Enter" closes the box.

On Thu, 19 Jan 2006 21:13:35 GMT, "Wayne Morgan"
<co***************************@hotmail.com> wrote:
Is there a way to get the message box to center on the form rather
than the screen?


Not that I know of. Instead of a MsgBox, you could create a form that looks
like a message box and place it where you want it. If you do, open this form
with the acDialog window mode argument of the DoCmd.OpenForm call.


Jan 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.