Combo Box Look UP

H

Ham Coder

I have a combo box that looks up three fields in a table, (Lastname,
firstname Middle name). I have a notinlist procedure that strips the entered
data (removes the comma and space and produces three distinct fields FName,
Mname, LName, then adds the data into the table appropriately. However the
using the acDataErrAdded it still returns not in list error, even though the
data was added. I believe it to be the combo box not dealing with the comma
correctly. Any suggestions around this problem. Maybe a mask, although i
would prefer a different method. Thanks
 
K

Klatuu

That is probably not the problem.
One of the first things necessary to do in the Not In List event is to Undo
the combo box; otherwise, it will fire the event twice and you will get the
error.
If you would like to post your code, I can show you where in the event it
should be.
 
M

Michael Gramelspacher

I have a combo box that looks up three fields in a table, (Lastname,
firstname Middle name). I have a notinlist procedure that strips the entered
data (removes the comma and space and produces three distinct fields FName,
Mname, LName, then adds the data into the table appropriately. However the
using the acDataErrAdded it still returns not in list error, even though the
data was added. I believe it to be the combo box not dealing with the comma
correctly. Any suggestions around this problem. Maybe a mask, although i
would prefer a different method. Thanks

Presumeably your combo has a concatenated column query as its row source, sot of
like this:

SELECT Persons.person_id,
[last_name] & (", " + [first_name]) & (" " + [middle_initial]) AS
FulName
FROM Persons
ORDER BY Persons.last_name,
Persons.first_name,
Persons.middle_initial;

When you type in a name that is not in the query, your not-in-list routine
parses the name into the three fields and adds them to the table. As long as
the concatenation of the added row yields the same valune as was typed, all is
ok. However, this does not seem to be the case here.
 
H

Ham Coder

The error identified had to do with how access treats string nulls. I did
not do an undo, but I saved the original data, did the add, replaced the
search string with the saved original and it finds the data just fine.
Thanks for your help. I will look at the undo and see if it is basically the
same thing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top