I did as you suggested.
This code allows opening a form with the unique record that I want to edit. It works well with all textboxes for the 7 days in the week .
Issue: I want to open just in front of the editing """cell""" but I don't know how to set location, because Top is always the same. How could I do it??
(just the last impulse, please)
Code:
Private Sub AbrirFormularioEdicion()
Dim strFecha As String
Dim strLinkCriteria As String
Dim intDiaQueAbre As Integer
Dim ctrl As Control
Dim strOpenArgs As String
Dim intTop As Integer
Set ctrl = Screen.ActiveControl
'Location of new form.
strOpenArgs = ctrl.Left & "|" & ctrl.Top
'Where condition
intDiaQueAbre = Right(ctrl.Name, 1)
strFecha = Forms!frmCuadrante.FechaLunes + (intDiaQueAbre - 1)
strLinkCriteria = "FechaJornada = #" & strFecha & "# AND NombreEmpleado = '" & Me.NombreEmpleado & "'"
DoCmd.OpenForm "frmEditarcuadrante", , , strLinkCriteria, , acDialog, strOpenArgs
End Sub
Private Sub Ctl1_Click()
AbrirFormularioEdicion
End Sub
Private Sub Ctl2_Click()
AbrirFormularioEdicion
End Sub
...
In the new form:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim strArgs() As String
Dim intLeft As Integer
Dim intTop As Integer
strArgs = Split(Me.OpenArgs, "|")
intLeft = strArgs(0)
intTop = strArgs(1)
DoCmd.MoveSize intLeft, intTop
End Sub