need to refresh and requery in VBA

S

Scott B

Greetings,

The following code is on a command button on Form A. The command opens Form
B and displays the current record for the person from Form A. It works
great. The Form A is controlled by a query and Form B is controlled by
query. I would like to add language to requery the underlying query for
Form B (refresh data added in Form A) and continue to find the current
record in Form A. What do I need to add to do this?

Thank you in advance for the help.

Scott B

_ _ _ BEGIN CODE _ _ _
Private Sub cmdOpenGuestRecord_Click()
On Error GoTo Err_cmdOpenGuestRecord_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmGuestWithRooms"

stLinkCriteria = "[FirstName]=" & "'" & Me![FirstName] & "'"
stLinkCriteria = "[LastName]=" & "'" & Me![LastName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenGuestRecord_Click:
Exit Sub

Err_cmdOpenGuestRecord_Click:
MsgBox Err.Description
Resume Exit_cmdOpenGuestRecord_Click

End Sub
_ _ _ END CODE _ _ _
 
Top