C
Christopher Glaeser
The code below uses ADO to "sequentially" search tblTasks for a matching key
and then extract the value of another field in that record to open a form.
Given that TaskID is the primary key of tblTasks, what is the efficient ADO
code to find that record? Any other commens on improving this code also
welcome.
Private Sub ctMDay0_AppDblClick(ByVal nIndex As Integer)
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "tblTasks", CurrentProject.Connection
rst.MoveFirst
Do Until rst.EOF()
If rst!TaskID = Me.ctMDay0.AppointData(nIndex) Then
DoCmd.OpenForm "frmWorkOrder", , , "WorkOrderID=" & rst!WorkOrderID
Exit Do
End If
rst.MoveNext
Loop
rst.Close
End Sub
and then extract the value of another field in that record to open a form.
Given that TaskID is the primary key of tblTasks, what is the efficient ADO
code to find that record? Any other commens on improving this code also
welcome.
Private Sub ctMDay0_AppDblClick(ByVal nIndex As Integer)
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "tblTasks", CurrentProject.Connection
rst.MoveFirst
Do Until rst.EOF()
If rst!TaskID = Me.ctMDay0.AppointData(nIndex) Then
DoCmd.OpenForm "frmWorkOrder", , , "WorkOrderID=" & rst!WorkOrderID
Exit Do
End If
rst.MoveNext
Loop
rst.Close
End Sub