[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

Combobox question

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
SteveL13
Asked:
SteveL13
1 Solution
 
mbizupCommented:
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
 
Jeffrey CoachmanCommented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now