Good Afternoon, I have a head scratcher on my hands. I am running a procedure to update a field on a form whose data is derived from a stored procedure with variables. I can successfully get this procedure to run, but it would reset the form on my Me.Requery. My attempt in the code below was to keep the user on the record they updated. Now comes the head scratcher. When I step through this code one line at a time, I get the desired result, yet when I simply run it without the pausing it, I get thrown to the top of the page again??? Any help is appreciated!
[Code/]
Private Sub Apprv_Click()
Dim ocmd As New Command
Dim strSQL As String
strSQL = "[dbo].[sp_CommissionsApproveSingle] '" & Me.pkey & "'"
Set ocmd.ActiveConnection = CurrentProject.Connection
ocmd.CommandText = strSQL
ocmd.Execute
Dim sPkey As String
sPkey = Me.pkey
Dim rs As Object
Set rs = Me.RecordsetClone
Me.Requery
rs.MoveFirst
rs.Find "[pkey] = '" & sPkey & "'"
Me.Bookmark = rs.Bookmark
[/Code]
[Code/]
Private Sub Apprv_Click()
Dim ocmd As New Command
Dim strSQL As String
strSQL = "[dbo].[sp_CommissionsApproveSingle] '" & Me.pkey & "'"
Set ocmd.ActiveConnection = CurrentProject.Connection
ocmd.CommandText = strSQL
ocmd.Execute
Dim sPkey As String
sPkey = Me.pkey
Dim rs As Object
Set rs = Me.RecordsetClone
Me.Requery
rs.MoveFirst
rs.Find "[pkey] = '" & sPkey & "'"
Me.Bookmark = rs.Bookmark
[/Code]