Ver Mensaje Individual
  #12 (permalink)  
Antiguo 18/12/2002, 18:36
Avatar de Bravenap
Bravenap
 
Fecha de Ingreso: noviembre-2002
Ubicación: Los Arroyos, El Escorial, Madrid
Mensajes: 2.084
Antigüedad: 21 años, 6 meses
Puntos: 4
Bueno, finalmente he resuelto esa pregunta, y no sé si lo habré hecho de una manera muy correcta pero al menos funciona.

Código:
Private Sub TextArt1_KeyPress(KeyAscii As Integer)
    If (KeyAscii = 13) Then
        articulo1 = TextArt1.Text
        Set rstPrestamos = db.OpenRecordset("select * from Prestamos where art1='" & articulo1 & "'")
        If Not rstPrestamos.EOF Then
            MsgBox "Artículo ya prestado", vbExclamation, "¡Atención!"
            TextArt1.Text = ""
        Else
            Set rstPrestamos = db.OpenRecordset("select * from Prestamos where art2='" & articulo1 & "'")
            If Not rstPrestamos.EOF Then
                MsgBox "Artículo ya prestado", vbExclamation, "¡Atención!"
                TextArt1.Text = ""
            Else
                Set rstArticulos = db.OpenRecordset("select descripcion from Articulos where codigo ='" & articulo1 & "'")
                If Not rstArticulos.EOF Then
                    Define(0).Caption = rstArticulos!descripcion
                    TextArt2.SetFocus
                Else
                    MsgBox "Artículo no registrado", vbExclamation, "¡Atención!"
                    TextArt1.Text = ""
                End If
            End If
        End If
    End If
End Sub
Gracias por tu ayuda, de momento dejaré así el código ya que funciona y ahora mismo tampoco tengo mucho tiempo para aprender otros métodos.
Hasta luego.