Button to open form

J

JMorrell

To help a user make corrections to previously entered data, I’ve given
them a form to enter the transaction key and click an OK button. This then
takes
the user to yet another form which displays the data they wish to correct.

The problem is that the user has to click the OK button twice to get the
data to display. The first time they click OK, the second form opens up and
the second time they click OK, the data appears. I used the button wizard to
build the code that opens the form. The code is as follows:

Private Sub butOpenfrmLeaveCorrection_Click()
On Error GoTo Err_butOpenfrmLeaveCorrection_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEmpLeaveCorrection"

stLinkCriteria = "[LeaveID]=" & Me![boxLID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_butOpenfrmLeaveCorrection_Click:
Exit Sub

Err_butOpenfrmLeaveCorrection_Click:
MsgBox Err.Description
Resume Exit_butOpenfrmLeaveCorrection_Click

End Sub

What is the way to get the second form’s data to display the first time the
user clicks the OK button.

tia,
 
Top