adding to a bound combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box created from 3 fields, CandidateID FirstName LastName. I
was having a problem with the way it displayed used Allen Browne's suggestion
where in the rowsource field I have a line like

Select Candidate.CandidateID, Trim(Employees.[FirstName]&" "&
Employees.[LastName]) As FullName FROM Candidates;

I have been trying to put in code that would add an entry that wasn't in the
combo box to the Candidate table. I found some code to do that but I can't
figure out if/how this new FullName field affects that.. It is not working as
it is and it seems that when I type in a name, John Doe, that name is a
single FullName value instead of being two pieces a FirstName and a LastName.

I have been having a problem with the code anyway and I was wondering if
that might be because CandidateID is the primary key and an autonumber and I
haven't addressed adding it when I add an new Candidate to the table.

Ryan
 
If CandidateID is an Autonumber, you don't want to add it: Access will take
care of it for you.

What you'll have to do, though, is figure out some way of splitting FullName
back into FirstName and LastName. In the case of names with only a single
space in them, that should be easy. However, in other cases, it isn't, so
you'll probably have to pop up a form to ask the user to provide the proper
split for you.
 
It seems that your table holds separate names.
Create a query and create the FullName: =[firstname]&" "&[MI]&" "&[Lastname]
Then you can use the query's FullName field for your combo, but data entry
is made to the individual fields.
 
Back
Top