Hello,
I am trying to set the focus to a particular control for the current record after a form is updated. It always just goes back up to the top of the form to the first field no matter how I write the code. Can anyone see what I am doing wrong. I am using the me.currentrecord and I stepped through and it is pointing to the correct record.
Me.Refresh
Dim db As Database
Dim strEncounterUpdateUnitSQLString As String
Dim qdf As QueryDef
Dim myrecnum As Long
myrecnum = Me.CurrentRecord
' Set database variable to current database.
Set db = CurrentDb
'Open QueryDef object.
Set qdf = db.QueryDefs("sp_UpdateIRRMeasure")
'Build SQL string to pass into sp_GetWorklistAMI based on user input parameters.
strEncounterUpdateUnitSQLString = "EXEC sp_UpdateIRRMeasure"
qdf.ReturnsRecords = False
'Assign query def sql command to the sql string built form user selections.
qdf.SQL = strEncounterUpdateUnitSQLString
'Execute the stored procedure.
qdf.Execute
qdf.Close
Me.Requery
Forms!frm_VarianceTracking!frm_IRR!cboAbstractor.SetFocus
'DoCmd.GoToRecord , , , myrecnum (commented out right now but tried both ways)
Me.Recordset.Move myrecnum
Me.RecordLocks = False
I am trying to set the focus to a particular control for the current record after a form is updated. It always just goes back up to the top of the form to the first field no matter how I write the code. Can anyone see what I am doing wrong. I am using the me.currentrecord and I stepped through and it is pointing to the correct record.
Me.Refresh
Dim db As Database
Dim strEncounterUpdateUnitSQLString As String
Dim qdf As QueryDef
Dim myrecnum As Long
myrecnum = Me.CurrentRecord
' Set database variable to current database.
Set db = CurrentDb
'Open QueryDef object.
Set qdf = db.QueryDefs("sp_UpdateIRRMeasure")
'Build SQL string to pass into sp_GetWorklistAMI based on user input parameters.
strEncounterUpdateUnitSQLString = "EXEC sp_UpdateIRRMeasure"
qdf.ReturnsRecords = False
'Assign query def sql command to the sql string built form user selections.
qdf.SQL = strEncounterUpdateUnitSQLString
'Execute the stored procedure.
qdf.Execute
qdf.Close
Me.Requery
Forms!frm_VarianceTracking!frm_IRR!cboAbstractor.SetFocus
'DoCmd.GoToRecord , , , myrecnum (commented out right now but tried both ways)
Me.Recordset.Move myrecnum
Me.RecordLocks = False