473,395 Members | 1,856 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,395 software developers and data experts.

NotInList event?

Just got done reading some of ADH2000 about comboboxes and the
NotInList event... Doesn't look like it's possible to tweak the
behavior of this so that I can have a non-text bound column, can I?
Say I have a Customers--Invoices relationship, and I want to be able
to pick the Customer's name from a combobox. (keeps people from
entering the same text - or worse, just almost the same - a zillion
times). So I create a CustomerID, enforce uniqueness CustomerName
field, and away I go... but what if I want to have my cake and eat it
too? Is there a way to allow a non-text bound column and then use
LimitToList?

I'll give an example in case what I'm saying isn't making sense...
Say I have a table of customers, (CustomerID,CustomerName). For
simplicity's sake, say that CustomerName is unique, and CustomerID
just acts as a surrogate for it and I store that because it's
easier... Can I still use some kind of LimitToList on my cboCustomer
combobox and have it work, or do I have to bind to the CustomerName
field in my table? (So it stores the ID, not the text value)

Thanks,

Pieter
Nov 12 '05 #1
3 2781
Response below.
Just got done reading some of ADH2000 about comboboxes and the
NotInList event... Doesn't look like it's possible to tweak the
behavior of this so that I can have a non-text bound column, can I?
Say I have a Customers--Invoices relationship, and I want to be able
to pick the Customer's name from a combobox. (keeps people from
entering the same text - or worse, just almost the same - a zillion
times). So I create a CustomerID, enforce uniqueness CustomerName
field, and away I go... but what if I want to have my cake and eat it
too? Is there a way to allow a non-text bound column and then use
LimitToList?

I'll give an example in case what I'm saying isn't making sense...
Say I have a table of customers, (CustomerID,CustomerName). For
simplicity's sake, say that CustomerName is unique, and CustomerID
just acts as a surrogate for it and I store that because it's
easier... Can I still use some kind of LimitToList on my cboCustomer
combobox and have it work, or do I have to bind to the CustomerName
field in my table? (So it stores the ID, not the text value)


You will simply need to grab the ID value (regardless of whether you add a
record by code or open a form for the user to enter the data) and assign that
value in your "NotIInList" event procedure to the combo box's "Value" prior to
setting Response to "acDataErrAdded", which will cause the combo box to requery.

--
Bruce M. Thompson
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #2
"Pieter Linden" <pi********@hotmail.com> wrote in message >
I'll give an example in case what I'm saying isn't making sense...
Say I have a table of customers, (CustomerID,CustomerName). For
simplicity's sake, say that CustomerName is unique, and CustomerID
just acts as a surrogate for it and I store that because it's
easier... Can I still use some kind of LimitToList on my cboCustomer
combobox and have it work, or do I have to bind to the CustomerName
field in my table? (So it stores the ID, not the text value)

What you explain is the standard default behaviour for ms-access combo
boxes. It is most common to store the id, but display, and search via the
text name (it is not clear if that is what you want...but sure makes sense
to me). If you build the combo box with the wizard, it default to your
desired setup. There should be no problem with your storing the id, but
displaying the customer name. This is the standard way the combo box
functions.
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
ka****@msn.com
http://www.attcanada.net/~kallal.msn

Nov 12 '05 #3
pi********@hotmail.com (Pieter Linden) wrote in
news:bf**************************@posting.google.c om:
Just got done reading some of ADH2000 about comboboxes and the
NotInList event... Doesn't look like it's possible to tweak
the behavior of this so that I can have a non-text bound
column, can I? Say I have a Customers--Invoices relationship,
and I want to be able to pick the Customer's name from a
combobox. (keeps people from entering the same text - or
worse, just almost the same - a zillion times). So I create a
CustomerID, enforce uniqueness CustomerName field, and away I
go... but what if I want to have my cake and eat it too? Is
there a way to allow a non-text bound column and then use
LimitToList?
Store your customer name and ID in a table, which becomes the
rowsource for your combo. Use the NotInList event to add the New
name and create a new UserID to the table when required.

I have the notInList event open a form, pass what the user has
typed via Openargs to a textbox, and allow the user the choice to
Accept or Cancel the New item. If he accepts, I calculate the next
ID, save the record, requery the list and move on. If the user
cancels, he gets a messagebox, stating that the entry was not
accepted, please re-enter.

I'll give an example in case what I'm saying isn't making
sense... Say I have a table of customers,
(CustomerID,CustomerName). For simplicity's sake, say that
CustomerName is unique, and CustomerID just acts as a
surrogate for it and I store that because it's easier... Can I
still use some kind of LimitToList on my cboCustomer combobox
and have it work, or do I have to bind to the CustomerName
field in my table? (So it stores the ID, not the text value)
Limit to list will trigger the notinlist event if your unbound
description isn't one of the existing values.


Thanks,

Pieter


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David Deacon | last post by:
Hi i have the following code in a CustomerID field if the user enters a notinlist customer then they should dbl click to open the customer form However this error occurs "You tried to assign a...
2
by: whilstiwait | last post by:
I have a form containing a number of unbound combo boxes in three columns. Each column has boxes named "aaaa0", "aaaa1", etc. Using syntax like: With Forms(Me.Form.Name).Controls("txtTechnology"...
4
by: CAD Fiend | last post by:
Hello, I have a combo box (cmbFirstName) on a form that is hitting a query (qryFirstName) and then putting that selected (or typed by user) value to the table field (name FirstName) on the table...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
3
by: Bryan | last post by:
I have a listbox that the user is able to add items to through and SQL statement that is run on the NotInList event. At the end of the event, I set Response = acDataErrAdded, telling access that...
7
by: Bryan | last post by:
I am trying to allow the user to add an item to a list if it is not found in a combobox. When the NotInList event is triggered I run a function "AddItem" that has a custom dialog box to add an...
1
imrosie
by: imrosie | last post by:
Hello (from Rosie the newbie), I recently got help with a wonderful event to perform this from 'thescripts'...it recognizes that a name is not in the list an allows for (after parsing first and...
2
FireMedic
by: FireMedic | last post by:
Hello all, I am creating an application that has an equipment inventory and maintenance form that has numerous subforms that are displayed depending on the category of equipment selected. I have...
6
by: Volker Neurath | last post by:
Hi all, I have a Problem with combobox-property "NotInList" and an unbound Form. The situation: On my main form i have three comboboxes for data-exchange (here: Names of distributor,...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.