
21/06/2007, 15:02
|
 | | | Fecha de Ingreso: marzo-2007
Mensajes: 307
Antigüedad: 18 años, 1 mes Puntos: 17 | |
Re: """msgbox no hay datos""" prueba esto
on error resume next 'LINEA NUEVA
Set con = CreateObject("ADODB.Connection")
con.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & "F:\Proyecto roaming global\Base.mdb")
busca = Text9.Text
SQL = "SELECT * FROM AGREGAR WHERE SERIAL LIKE '" & busca & "'"
Set RS = con.Execute(SQL)
rs.movefirst 'LINEA NUEVA KE FUERZA LA CAIDA DEL PROGRAMA CUANDO NO HAY REGISTROS
if err.number <> 0 then 'SI NO TIENE REGISTROS ENTRA POR ACA
msgbox "no hay datos"
else
Do While Not RS.EOF
Text13.Text = Text13.Text & RS("SIMCARD")
Text14.Text = Text14.Text & RS("EQUIPO")
Text15.Text = Text15.Text & RS("MARCA")
Text16.Text = Text16.Text & RS("MODELO")
Text17.Text = Text17.Text & RS("BATERIA")
Text18.Text = Text18.Text & RS("CARGADOR")
Text19.Text = Text19.Text & RS("CLIENTE")
Text20.Text = Text20.Text & RS("CEDULA")
Text21.Text = Text21.Text & RS("NUMERODETELEFONO")
Text22.Text = Text22.Text & RS("ENTREGADOPOR")
Text23.Text = Text23.Text & RS("RECIBIDOPOR")
Text24.Text = Text24.Text & RS("FECHA")
Text8.Text = Text8.Text & RS("EQUIPOEN")
RS.MoveNext
Loop
endif
basicamente muevo la tabla al primer registro para saber si tiene datos, si no encuentra ningun registro, el programa se cae con un error 3021, el if captura cualquier error ke genere el movefirst y envia el mensaje ke kieras. |