A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

update form after adding to combo box



 
 
Thread Tools Display Modes
  #21  
Old August 3rd, 2007, 09:56 PM posted to microsoft.public.access.forms
Carl Rapson
external usenet poster
 
Posts: 517
Default update form after adding to combo box

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" u36251@uwe wrote in message
news:7627bcb00298d@uwe...
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 Rapson wrote:
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


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200708/1



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.