update form after adding to combo box

  • Thread starter Thread starter Jess12
  • Start date Start date
Thanks for the recap. The way we've been discussing should work, at least I
can't see any reason why it wouldn't. After adding the new client record,
you will need to requery the form in order for the new record to show up in
the form's Record Source. I'm guessing that you're not seeing the new record
because the record doesn't exist in the form's Record Source until you
requery (which happens when you close and reopen the form). The new entry
shows up in the combo box because the combo box is automatically requeried
when you return acDataErrAdded.

To start cleanly, this is what should work:

1. Add the new record
2. Requery the form
3. Locate the new record with FindFirst
4. Position to the new record with Bookmark

I've used this procedure many times, although never in the NotInList event
of a combo box. I usually have a command button next to my combo box, and I
use this process in the Click event of the button. But it has always worked
for me, and I've never seen the form requery cause an endless loop. At this
point, I can't really see anything else you could try that you haven't
already done.

Carl Rapson

Jess12 via AccessMonster.com said:
This form is based on 2 tables - Clients and CallLog. The mainform is
based
on the Clients table and the subform on the CallLog table. The main form
has
a combo box to look up clients and their respective call log information -
this part is working fine. I wanted to be able to add records to the
clients
table if somebody tries to enter a client who is not already in the combo
box.
The code does add the client, but once the client is added it is not
recognized by the form. I would like for the form to look up the new
client
once it is added, but the client doesn't get into the combo box until I
close
out the form and open it again. Is there a way to automatically add the
client and then be able to have the record on the form, with any related
information (which should only be the client name and ID from the Clients
table). Right now, what happens is, the new name appears in the combo
box,
but for some reason the rest of the information that shows up on the form
is
for the first client listed in the table.

Carl said:
I've never had a problem with a requery causing an endless loop.
Unfortunately, this thread has been going on so long that I can't remember
your form design. What is the record source of the main form, and what is
the record source of the subform? When you make a selection from the combo
box or add a new entry to the combo box, which do you want to happen?

Carl Rapson
It seems as if my requery is what was causing the loop. I changed it to
only
[quoted text clipped - 19 lines]
Carl Rapson
 
Back
Top