Solved

Combobox question

Posted on 2012-03-15
2
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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.

696 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