Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / January 2006

Tip: Looking for answers? Try searching our database.

Updating Tables within Forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jennifer Cali - 19 Jan 2006 03:50 GMT
I have a database that I use to track my recipes. I have the main table as
"Recipes" and a field in that table as "Meat Type". In order to keep things
consistent, "Meat Type" is a dropdown. I've added a button to the main form
beside the "Meat Type" box that says "Add" - I use this to add a meat if it
doesn't already exist in the dropdown. Where I run into a problem is that
when I enter the "Meat Type" form and input a new value & save/exit, I go
back to the "Recipes" form (which is what I want) but the new value doesn't
appear in the dropdown (which I need it to). I can only make it appear by
first exiting out of the "Recipes" form and then going back in. Is there a
way to refresh the "Recipes" form/table when a new "Meat Type" is added
without having to exit & reenter the form?
Signature

Thank you! - Jennifer

Allen Browne - 19 Jan 2006 04:19 GMT
Use the AfterUpdate event procedure of the *form* where you add new meat
types, to Requery the combo on the other form it is open.

This kind of thing:

Private Sub Form_AfterUpdate()
   If CurrentProject.AllForms("Form1").IsLoaded Then
       Forms("Form1")![Meat Type].Requery
   End If
End Sub

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have a database that I use to track my recipes. I have the main table as
> "Recipes" and a field in that table as "Meat Type". In order to keep
[quoted text clipped - 11 lines]
> way to refresh the "Recipes" form/table when a new "Meat Type" is added
> without having to exit & reenter the form?
Jennifer Cali - 19 Jan 2006 15:27 GMT
Hi Allen,
Thanks for the help - but would you please explain where I add the event? Do
I need to add a button to the screen or is there somewhere on the form that I
can paste the VB (one of the properties boxes)? You've been so helpful -
thanks!
Signature

Thank you! - Jennifer

> Use the AfterUpdate event procedure of the *form* where you add new meat
> types, to Requery the combo on the other form it is open.
[quoted text clipped - 22 lines]
> > way to refresh the "Recipes" form/table when a new "Meat Type" is added
> > without having to exit & reenter the form?
Allen Browne - 19 Jan 2006 15:43 GMT
1. Open the form where you add the meat type, in Design view.

2. Open the Properties box.

3. Make sure you are looking at the properties of the form, not those of the
text box. (The Title of the Properties box should read "Form.")

4. On the Event tab, set the AfterUpdate property to:
       [Event Procedure]

5. Click the Build button (...) beside that.
Access opens the code window.

6. Add the 3 lines of code between the "Private Sub..." and "End Sub" lines.

7. Replace the 2 references to "Form1" with the actual name of your other
form.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi Allen,
> Thanks for the help - but would you please explain where I add the event?
[quoted text clipped - 36 lines]
>> > way to refresh the "Recipes" form/table when a new "Meat Type" is added
>> > without having to exit & reenter the form?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.