473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Access Combobox Match found?

TheSmileyCoder
2,322 Expert Mod 2GB
I have a combobox on my form, which has its MatchRequired set to false. Basicly this means you can write new selections into the combobox. The rowsource of the combobox selects (distinct) all previous entries of that field in the underlying table.

The aim is no try and make what people write into the field uniform, but not limiting them to a pre-defined list.

My problem is that if a user types a new value that doesn't exist in the underlying query, I need to requery the combobox before it becomes available for the next record entry.

I would like to know in the Combobox before_Update event, whether or not a match was found, and if not, requery the combobox in the afterupdate event.
Sep 3 '12 #1
4 3910
zmbd
5,501 Expert Mod 4TB
TheSmileyCoder ...
Is it possible to use the "notinlist event" for what you are trying to do...

http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
This is for V2003; however, is still valid in V2010

-z
Sep 3 '12 #2
TheSmileyCoder
2,322 Expert Mod 2GB
As I read your post I initially thought *Facepalm* but then I realised that the "not in list" event only fires if the combobox is set with "Limit to list" as true. To maintain a list in the way you suggest I would need to add the value to a seperate table, in which case its true I could limit it to list, and have the not in list event add the value to the table. However I was hoping to not have to add an extra table.


I also soon after realised that it is no use to requery the value in the combobox's afterupdate event, since the value will not yet have been written to the table, it doesn't get written to table until the whole record is saved.
Sep 3 '12 #3
zmbd
5,501 Expert Mod 4TB
TheSmileyCoder

This is a modification of some code I found some years ago, see if it works for you.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub cbo_exampleupdatelist_NotInList(NewData As String, Response As Integer)
  5. Dim z_ctl As Control
  6. Dim z_YesNo As Integer
  7. '
  8. 'Setup to handle the control
  9. Set z_ctl = Me.cbo_exampleupdatelist
  10. '
  11. 'Verify that the user is entering a new value:
  12. z_YesNo = MsgBox("The value:" & vbCrLf & NewData & vbCrLf _
  13.     & "Is not currently in the list." & vbCrLf _
  14.     & "Would you like to add it?", vbQuestion + vbYesNo + vbDefaultButton2, _
  15.     "Verify Data Entry")
  16. If z_YesNo = vbYes Then
  17.     ' Set Response argument to indicate that data
  18.     ' is being added.
  19.     Response = acDataErrAdded
  20.     ' Add string in NewData argument to row source.
  21.     z_ctl.RowSource = z_ctl.RowSource & ";" & NewData
  22. Else
  23.     'If user chooses Cancel, suppress error message
  24.     ' and undo changes.
  25.     Response = acDataErrContinue
  26.     z_ctl.Undo
  27. End If
  28. End Sub
  29.  
-z
Sep 3 '12 #4
zmbd
5,501 Expert Mod 4TB
Here's another nice set of code...
http://msdn.microsoft.com/en-us/library/office/ff845736

I must have used something from one of the Inside&Out books as my code is fairy close to one listed in the link.

-z
Sep 3 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Chris Lasher | last post by:
Hello, I really like the finditer() method of the re module. I'm having difficulty at the moment, however, because finditer() still creates a callable-iterator oject, even when no match is found....
2
by: Denon | last post by:
Hi, everybody I have a web control, build by VB.net, and if I put two instance on the same aspx, error occur while debugging. Parser Error Message: Ambiguous match found. It highlight the...
3
by: Ben | last post by:
Hi I have just created a new ASP .net web project and when i run the project I receieve this error: System.Reflection.AmbiguousMatchException: Ambiguous match found. Any help would be much...
3
by: Alexandre | last post by:
Hi! I receive this error in my webapp: Ambiguous match found. At line: Line 1: <%@ page language="C#" masterpagefile="~/memberscontents/master_interna.master" autoeventwireup="true"...
0
by: Coach | last post by:
I have just migrated an application from VS2003 to VS2005 and now receive Ambigous Match Found error. I changed my Control Tag to represent 2005 and now I receive an error stating "another...
1
by: andrewbda | last post by:
I have a combo box in a subform that will have different options depending on values in the main form. I would like the combo box to default to the first value in the list. Any help would be...
3
by: sharperrr | last post by:
Access2000 Hi I have a combobox which displays a list of values dependent on another field. On the fields onchange event the rowsource of the combobox changes according to the value in the...
1
by: bobika | last post by:
Hi Im am implementing a small database system using MS Access. I have two main fields: :product category and product type! Product category contains ABC and XYZ categories. I added both in the...
3
by: Paulers | last post by:
Hello all, I have been pulling my hair out trying to figure out how to access the selected text in a combobox from another thread. I can get it working with a textbox but it does not with a...
2
by: aparna | last post by:
Hi, I have one project in dotnet 1.1and when I am trying to compile that project I am getting "Ambiguous match found" error in code behind file(.aspx.cs) but there is no such file in that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.