Ok.
I got this one running:
Private Sub btnRemover_Click()
Dim rs As DAO.Recordset
Dim RecIndex As Integer
Dim strSelect As String
RecIndex = [lintTurmaMatrizKMaster]
' RunCommand acCmdDeleteRecord
MsgBox RecIndex
If IsNull([Form].[CurrentRecord]) Then ' ******** I suppose it
doesn't work - I'll see later
MsgBox "Erro: Seleccione um registo (clicando com o rato) na
listagem seleccionando, eventualmente, uma turma."
Exit Sub
End If
MsgBox "vai apagar o aluno lintTurmaCheiaKMaster = " & RecIndex
strSelect = "SELECT tblTurmaMatriz.lintTurmaMatrizKMaster FROM
tblTurmaMatriz WHERE tblTurmaMatriz.lintTurmaMatrizKMaster = " &
RecIndex
Set rs = DBEngine(0)(0).OpenRecordset(strSelect)
If Not rs.EOF Then
rs.Delete
End If
rs.Close
Set rs = Nothing
Me.Requery
End Sub
Now, I would prefer something like
Set rs = DBEngine(0)(0).OpenRecordset("qryTurmaMatrizAlunoApaga")
rs.Filter = "lintTurmaMatrizKMaster = """ & RecIndex & """"
rs.Requery '' ****** not sure it is needed
The query "qryTurmaMatrizAlunoApaga" is the same as strSelect
Thanks for help,
Henry