Solved

Combobox question

Posted on 2012-03-15
2
251 Views
Last Modified: 2012-06-27
On a form I have a combobox.  When the user enters a record that does not exist I want a message to appear letting them know the record does not exist and then leave the form blank with no record showing.

How can I do this?

--Steve
0
Comment
Question by:SteveL13
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 37725203
Can you clarify your question?

Is this a 'search' combo box for filtering your form?

If that is the case then something like this should work in the after update event of your combo (assuming the bound field is an ID field)


Dim rs as DAO.recordset
set rs = Me.RecordsetClone
rs.findfirst "ID = " & Me.YourCombo
if rs.NoMatch= true then
          msgbox("No record found.  Opening New record")
          docmd.RunCommand acCmdRecordsGoToNew
End if
set rs = nothing
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37725737
Like mbizup, we need more details.

Is this combobox "Filtering" the form or Finding a record on the form?
You state:
<leave the form blank with no record showing.>
...Not sure what this means...as you did not state what the ultimate goal of this system is...
or state the design of this form.

If the form is "Bound" and you are "Filtering", the only way to be "blank with no record showing.", is to move to a new record.
This is what typically happens when you filter, and there are no results...

Remember that you can set the combobox so users *can't* enter invalid values.
Set the "Limit To List" property to: No

Let me know if I am misunderstanding something
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now