para enrique
Publicado por manuel (51 intervenciones) el 23/07/2008 18:37:25
Hola enrique .. te escribo pidiendo me ayudes con este dilema ...ya antes has colaborado conmigo y te pido nuevamente lo hogas ... esto es parte de un codigo tuyo que encontre y lo amolde a mi necesida ... te dire que esto es para un modulo de emision entre varias estaciones el error que me ocurre es el 2046 y me quedo ahi no pudiendo superarlo
Espero tus gratas noticias
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo NroExiste
If IsNull(HORINI) Or IsNull(STATUS) Then
MsgBox "Ingrese datos requeridos ...!", vbExclamation + vbOKOnly, Caption
Cancel = -1
ElseIf Me.NewRecord Then
' If Nz(DLookup("NUMDOC", "PERMISOS", "NUMDOC =" & DMax("numdoc", "permisos") + 1), 0) = 0 Then
NUMDOC = DMax("numdoc", "permisos") + 1
AUDITOR = CurrentUser() & " " & Mid(Usuario, 1, Len(Usuario) - 1) & " " & Ordenador & " " & Now()
DoCmd.RunCommand acCmdSaveRecord
Me.Parent.NUMERO = NUMDOC
Me.Parent.STAT = STATUS
' End If
End If
Exit Sub
NroExiste:
If Err.Number = 3022 Or Err.Number = 2115 Then
NUMDOC = DMax("numdoc", "permisos") + 2
DoCmd.RunCommand acCmdSaveRecord
Else
Resume Next
End If
End Sub
Espero tus gratas noticias
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo NroExiste
If IsNull(HORINI) Or IsNull(STATUS) Then
MsgBox "Ingrese datos requeridos ...!", vbExclamation + vbOKOnly, Caption
Cancel = -1
ElseIf Me.NewRecord Then
' If Nz(DLookup("NUMDOC", "PERMISOS", "NUMDOC =" & DMax("numdoc", "permisos") + 1), 0) = 0 Then
NUMDOC = DMax("numdoc", "permisos") + 1
AUDITOR = CurrentUser() & " " & Mid(Usuario, 1, Len(Usuario) - 1) & " " & Ordenador & " " & Now()
DoCmd.RunCommand acCmdSaveRecord
Me.Parent.NUMERO = NUMDOC
Me.Parent.STAT = STATUS
' End If
End If
Exit Sub
NroExiste:
If Err.Number = 3022 Or Err.Number = 2115 Then
NUMDOC = DMax("numdoc", "permisos") + 2
DoCmd.RunCommand acCmdSaveRecord
Else
Resume Next
End If
End Sub
Valora esta pregunta
0