Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/06/2005, 09:46
Avatar de Saruman
Saruman
 
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años, 11 meses
Puntos: 5
chequea esto para ver si te sirve... calcula y suma el numero con el año incluido y agrega la cantidad de ceros.


Código:
 
sSQL = "select max(campo) as ultimo_registro from tabla"
set RSUltimoRegistro = Master.Execute(sSQL)
if RSUltimoRegistro.bof=false and RSUltimoRegistro.eof=false then
ultimo_id = RSUltimoRegistro("ultimo_registro")
ano = right(year(date()), 2)
new_id = clng(left(ultimo_id, instr(ultimo_id, "-")-1)) + 1
new_id = right("0000000" & new_id, 7)
new_id = new_id & "-" & ano
 
response.Write(new_id)
end if
la variable new_id te trae el siguiente y con ella entonces haces lo que quieras (insert por ejemplo)

saludos

pd. con lo que dijo Myakire lo puedes hacer... buena sugerencia Myakire.
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.