?
Solved

Combobox question

Posted on 2012-03-15
2
Medium Priority
?
260 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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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.
Suggested Courses

765 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