Ver registro ya registrado
Publicado por Antonio (38 intervenciones) el 02/01/2007 20:11:37
Saludos y Feliz Año 2007. Comento mi tema por si alguien me puede orientar o decir como hacerlo. Tengo una tabla llamada registro de vehiculos, y un formulario llamado Altas.En dicho formulario tengo un campo llamado Matricula, que voy introduciendo, pero cuando introduzco una matricula que ya estaba me sale un cuando en el que digo que la matricula ya ha sido registrada. Para esto navegando he copiado esto que me hace lo que quiero:
Private Sub MATRICULA_BeforeUpdate(Cancel As Integer)
Dim rst As DAO.Recordset, _
strSQL As String
strSQL = "SELECT [MATRICULA] "
strSQL = strSQL & "FROM [REGISTRO DE VEHICULOS] "
strSQL = strSQL & "WHERE [MATRICULA] ='" & Me.[MATRICULA] & "'"
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
If Not rst.EOF And Not rst.BOF Then
MsgBox "LA MATRICULA " & Me.MATRICULA & " YA ESTA REGISTRADA", vbOKOnly + vbInformation, "ATENCION"
End If
If Not rst Is Nothing Then
rst.Close
Set rst = Nothing
End If
End Sub
Mi pregunta viene ahora, Que instruccion debo poner y en donde, para que cuando me salga el Msbox pueda abrir otro formulario donde pueda visualizar los datos del vehiculo.
Private Sub MATRICULA_BeforeUpdate(Cancel As Integer)
Dim rst As DAO.Recordset, _
strSQL As String
strSQL = "SELECT [MATRICULA] "
strSQL = strSQL & "FROM [REGISTRO DE VEHICULOS] "
strSQL = strSQL & "WHERE [MATRICULA] ='" & Me.[MATRICULA] & "'"
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
If Not rst.EOF And Not rst.BOF Then
MsgBox "LA MATRICULA " & Me.MATRICULA & " YA ESTA REGISTRADA", vbOKOnly + vbInformation, "ATENCION"
End If
If Not rst Is Nothing Then
rst.Close
Set rst = Nothing
End If
End Sub
Mi pregunta viene ahora, Que instruccion debo poner y en donde, para que cuando me salga el Msbox pueda abrir otro formulario donde pueda visualizar los datos del vehiculo.
Valora esta pregunta


0