Updating Form

mdg

Registered User.
Local time
Yesterday, 21:29
Joined
Feb 17, 2011
Messages
68
I have 2 forms. One has all the fields locked so no one can change anything from inside the form. I have a button on the form that opens up an identical form but not locked so one can enter a new record. When I save and close the 2nd form, the 1st form will not show the new record until I close and reopen it. Is there a way to update the 1st form after saving the new record in the 2nd form. See attached view of the two forms. Thank You.
 

Attachments

  • Form 1.jpg
    Form 1.jpg
    93.6 KB · Views: 132
  • form2.jpg
    form2.jpg
    86 KB · Views: 140
As part of the On Close event of your Second form put some code like;
Code:
Forms![COLOR="Red"]YourFirstFormName[/COLOR].Requery
Change the red highlighted section to reflect the reality of your DB. This code will force your first form to Requery it's Record Source and pick up all the new records.
 
Last edited:
Thanks for your reply John Big Booty. For some reason, when I do this on closing the 2nd form, I get an error msg saying 'cannot find firstform'. Not sure why, I checked spelling etc.. But what I did was use your suggestion and simply added a 'requery' command to the first form and works fine. Don't know why I didn't think of that before. Would be nice though to get it to automatically querry when I exit the 2nd form. Any reason you would know why access doesn't recognize the first form name (formoversightcasetracker).
 
Could you please, show the code of that you have written also the names of the first form and second form
 
Thanks for your reply John Big Booty. For some reason, when I do this on closing the 2nd form, I get an error msg saying 'cannot find firstform'. Not sure why, I checked spelling etc.. But what I did was use your suggestion and simply added a 'requery' command to the first form and works fine. Don't know why I didn't think of that before. Would be nice though to get it to automatically querry when I exit the 2nd form. Any reason you would know why access doesn't recognize the first form name (formoversightcasetracker).

You would seem to have used firstform as the form name rather than formoversightcasetracker, so your code should look like;

Code:
Forms!formoversightcasetracker.Requery
If I've understood you correctly :o
 
Just got back to my computer. Thanks for your reply again. I did use the correct form name. I wasn't clear in my previous post. My code does look like what you posted, but comes up with the error msg, that's why I'm puzzled, it should work.
 
Thanks for your assistance. I just noticed your reply to my post. The code looks like this.
Private Sub Form_Close()
Forms!FormOversightCaseTracker.Requery
End Sub
The first form name is the above form name and the 2nd form is formoversightcasetracker2
 
Hi Chaps

I've been doing something similar quite a bit on my current Access 2010 database.

This may or may not help you.

I have a main form FRMRFS and on the form a button that opens a second form FRMProjectManager.

When I open FRMProjectManager and make and amendment and close it, I needed FRMRFS to display the new data.

I opened FRMProjectManager and in Close Event I added:

Private Sub Form_Close()
Form_FRMRFS.Refresh
End Sub

I works perfectly. I hope this helps.

Allison
 

Users who are viewing this thread

Back
Top Bottom