0
나는 작은 도움이 필요한 사람. 양식이 있고 목록 상자를 선택하면 일부 필드가 채워지고 양식에 하위 폼이 채워집니다. 내가 달성하고자하는 것은 하위 형식이 0 개의 레코드가 있어서는 안된다는 것입니다. 그래서 레코드가 0인지 확인하고 메시지를 팝업하지만 exit 서브가 도움이되지 않아 사용자가 다음 레코드를 얻을 수있는 컨트롤이 있는지 확인합니다.MS 액세스에서 ListBox 선택
Private Sub lstRev_BeforeUpdate(Cancel As Integer)
Dim DataConn10 As New ADODB.Recordset
Dim Comm10 As String
Set Conn = CurrentProject.Connection
Comm10 = " SELECT tblLIVE.SID " & _
" FROM tblLIVE " & _
" WHERE tblLIVE.CID = " & Me.txtCID & " And tblLIVE.PID =
" & Me.txtPIDRev & " And tblLIVE.MNumber = '" & Me.txtSMNum & "'"
DataConn10.Open Comm10, Conn, adOpenKeyset, adLockOptimistic
If DataConn10.RecordCount = 0 And Not IsNull(Me.txtMIDRev) Then
Dim x As Integer
x = MsgBox("Are sure that you want to leave the form without adding Line in subform. If you press yes Rev will be deleted. If you press No please enter Line", vbYesNo)
If x = vbYes Then
MsgBox "Delete"
Else
MsgBox "EnterSOV"
'Here I need something to tell him to stay in the same record :(
DataConn10.Close
Exit Sub
End If
End If
End Sub
코드를 알려주십시오. –