UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Form doesn't update without close/reopen    
 
   
larrychuck
post May 29 2006, 03:13 PM
Post #1

UtterAccess Enthusiast
Posts: 52
From: San Francisco, CA



I have a tabbed form (two tabs). One tab contains a form for adding a new record to TblClients. The other tab contains a more complicated form with an unbound combo box to choose from the list of all clients, and then a couple of subforms displaying various fields (related to the chosen client) from other tables (all connected by ClientID). My intent is to use the tabbed form as an multi-purpose tool to add new clients and/or update info for new or existing clients. For the most part, everything is working as I intend it to. But one thing has me stumped...

I would like to be able to add a new client on the first tab, then go to the second tab, pick the client I just added from the combo, and then add additional data to the related tables via the subforms. I am able to add the client, then pick their name from the combo, but the related fields on the form/subforms don't update. If I choose an existing client, they do. If I close the form and reopen it, it works fine...

So obviously when I open the form, something is happening behind the scenes. I guess what I need to do is add an event that tells the form to do THAT THING everytime I select a client from the unbound combo. Is that on the right track? Can anyone tell me how to accomplish this? As always, THANKS!
Go to the top of the page
 
+
HiTechCoach
post May 29 2006, 03:33 PM
Post #2

UtterAccess VIP
Posts: 18,396
From: Oklahoma City, Oklahoma



QUOTE
So obviously when I open the form, something is happening behind the scenes.

That would basically be a requery of all the record sources.

After adding a record in the first tab. you will need to have all the other sub forms requery. This will have the same effect as closing the form and opening it again.

Hope this helps...


Edited by: HiTechCoach on Mon May 29 16:35:06 EDT 2006.
Go to the top of the page
 
+
larrychuck
post May 29 2006, 04:58 PM
Post #3

UtterAccess Enthusiast
Posts: 52
From: San Francisco, CA



Makes sense. Any pointers about how to "have all the other sub forms requery"? I really have no idea how to do that... A hint? ;-)
Go to the top of the page
 
+
HiTechCoach
post May 30 2006, 12:26 PM
Post #4

UtterAccess VIP
Posts: 18,396
From: Oklahoma City, Oklahoma



In the after update event for the form that adds the record you will need a separate line of code to requery each ojbect like this:


If the parent form adds the record use:

Me.[SubformName].Form.Requery

If a sub form adds the record use:

Me.Parent.[SubformName].Form.Requery


Where you will substitute the actual name of the sub form for [SubformName].

To requery a combo box use:

If on the same form use:

Me.[ComboBoxName].Requery


If from one sub form to another sub form use:

Me.Parent.[SubformName].Form.Requery


Also check out:

Refer to Form and Subform properties and controls


Hope this helps...
Go to the top of the page
 
+
larrychuck
post Jun 1 2006, 08:59 PM
Post #5

UtterAccess Enthusiast
Posts: 52
From: San Francisco, CA



Fantastic. Thank you so much!
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 03:43 PM