Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hola muy buenas tardes ..Estoy buscando como agregar números consecutivos mediante una consulta o agregarlas directamente a mi tabla con un indicador que me muestre cual fue mi ultimo registro

24 views
Skip to first unread message

Lizbeth Roblero Morales

unread,
Sep 2, 2021, 8:23:12 PM9/2/21
to
Esta es mi consulta Pero al momento de ejecutarla me manda todo en cero y quiero que me enumere consecutivamente

SELECT CLIENTES.FECHA, CLIENTES.CLIENTE, CLIENTES.CEDULA, CLIENTES.TELEFONO, NumeroDeOrden([CLIENTE]) AS Consecutivo
FROM CLIENTES;


Aquí declaro mi variable
Public Function NumeroDeOrden(ByVal Dato As Variant) As String
Static Consecutivo As Long
Static DatoAnterior As String
If Dato = DatoAnterior Then
Consecutivo = Consecutivo + 1
Else
DatoAnterior = Dato
Consecutivo = 0
End If

NumeroDeOrden = Format(Consecutivo, "0000")


End Function




Espero contar con su apoyo, No tengo mucha experiencia en esto ...Linda tarde
0 new messages