Indice
Publicado por antonio (114 intervenciones) el 16/02/2011 14:59:53
Hola a todos.
Tengo una base de datos de facturas
Id facturas
numerofacturas
id empresa-persona. (esto me sirve para relacionarlo con la empresa que da la factura)
Para evitar duplicación de las facturas puse este código
Private Sub Nº_Factura_BeforeUpdate(Cancel As Integer)
Dim rst As DAO.Recordset, _
strSQL As String
strSQL = "SELECT [numerofactura] "
strSQL = strSQL & "FROM [facturaliquidaciones] "
strSQL = strSQL & "WHERE [numerofactura] ='" & Me.[Nº_Factura] & "'"
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
If Not rst.EOF And Not rst.BOF Then
Me.lbl1.Visible = True
MsgBox "ESTE REGISTRO YA FUE CARGADO", vbOKOnly + vbInformation, "ATENCION"
Me.Undo
Me.lbl1.Visible = False
End If
If Not rst Is Nothing Then
rst.Close
Set rst = Nothing
End If
End Sub
Ahora me he dado cuenta que hay empresas que coinciden en la numeración de facturas. Por lo que tengo que crear la forma que empresas distintas puedan tener el mismo número de facturas
He creado un indice pero aún así nada.
Espero vuestros comentarios
Graccias
Tengo una base de datos de facturas
Id facturas
numerofacturas
id empresa-persona. (esto me sirve para relacionarlo con la empresa que da la factura)
Para evitar duplicación de las facturas puse este código
Private Sub Nº_Factura_BeforeUpdate(Cancel As Integer)
Dim rst As DAO.Recordset, _
strSQL As String
strSQL = "SELECT [numerofactura] "
strSQL = strSQL & "FROM [facturaliquidaciones] "
strSQL = strSQL & "WHERE [numerofactura] ='" & Me.[Nº_Factura] & "'"
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
If Not rst.EOF And Not rst.BOF Then
Me.lbl1.Visible = True
MsgBox "ESTE REGISTRO YA FUE CARGADO", vbOKOnly + vbInformation, "ATENCION"
Me.Undo
Me.lbl1.Visible = False
End If
If Not rst Is Nothing Then
rst.Close
Set rst = Nothing
End If
End Sub
Ahora me he dado cuenta que hay empresas que coinciden en la numeración de facturas. Por lo que tengo que crear la forma que empresas distintas puedan tener el mismo número de facturas
He creado un indice pero aún así nada.
Espero vuestros comentarios
Graccias
Valora esta pregunta
0