Solved

Combobox question

Posted on 2012-03-15
2
254 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

827 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