Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refresh form after adding record in another form 2

Status
Not open for further replies.

thowe

Technical User
Jun 8, 2001
45
US
Hi what I am trying to do is:
I have a form that has a button that makes another form pop up that allows users to enter new data. AFter they are done entering new data they click a button that says "save and close"( this button is based on a macro) but as soon as the user is taken back to the original form, the data isn't there, only after I exit the form and come back to it is it there. I think this means that the form needs to be refreshed as soon as it returned to. But on WHAT event should I put the code me.refresh -- it cant be ON OPEN becuase the form is already opened, help?
 
Go to the "Event Procedure" for the "On Click" of the button you are working with (Save and Close). Click the "..." to bring you to the VBA portion of your button.

Place this on top of your event

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Should look something like this now . . .

------------------------------------------
Private Sub Command12_Click()
On Error GoTo Err_Command12_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
stDocName = "WHATEVERYOUROPENINGWITHYOURBUTTON"
DoCmd.OpenForm stDocName, acPreview

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub
-----------------------------------------------

Hope this helps!
Chance~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top