VERSION 5.00 Begin VB.Form Form4 BackColor = &H00C0CEC0& BorderStyle = 4 'Fixed ToolWindow Caption = " Alta Producto Final" ClientHeight = 2700 ClientLeft = 45 ClientTop = 345 ClientWidth = 4995 LinkTopic = "Form4" MaxButton = 0 'False MDIChild = -1 'True MinButton = 0 'False ScaleHeight = 2700 ScaleWidth = 4995 ShowInTaskbar = 0 'False Begin VB.TextBox Text3 Height = 285 Left = 2760 TabIndex = 2 Top = 1200 Width = 615 End Begin VB.CommandButton Command2 Caption = "Cancelar" Height = 375 Left = 960 Style = 1 'Graphical TabIndex = 6 Top = 1920 Width = 1335 End Begin VB.TextBox Text2 Height = 285 Left = 2760 TabIndex = 1 Top = 720 Width = 1815 End Begin VB.TextBox Text1 Height = 285 Left = 2760 MaxLength = 7 TabIndex = 0 Top = 240 Width = 1815 End Begin VB.CommandButton Command1 Caption = "Siguiente" Height = 375 Left = 2760 Style = 1 'Graphical TabIndex = 4 Top = 1920 Width = 1335 End Begin VB.Label Label3 Alignment = 2 'Center BackColor = &H00C0E0FF& Caption = "Unidades por utillaje Robot" Height = 255 Left = 360 TabIndex = 7 Top = 1200 Width = 1935 End Begin VB.Label Label2 Alignment = 2 'Center BackColor = &H00C0E0FF& Caption = "Descripción Producto" Height = 255 Left = 360 TabIndex = 3 Top = 720 Width = 1935 End Begin VB.Label Label1 Alignment = 2 'Center BackColor = &H00C0E0FF& Caption = "Referencia Producto" Height = 255 Left = 360 TabIndex = 5 Top = 240 Width = 1935 End End Attribute VB_Name = "Form4" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private conn As New ADODB.Connection Private rsproducto As ADODB.Recordset Private rspieza As ADODB.Recordset Private rsproceso As ADODB.Recordset Private Sub Command1_Click() 'PASO DE DATOS A LA BASE DE DATOS ' Por si ya estaba abierta la conexion ... Set conn = Nothing Set rsproducto = Nothing ' Crear los objetos Set conn = New ADODB.Connection Set rsproducto = New ADODB.Recordset ' Abrir la base con el proveedor correspondiente conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\DBPROSS.mdb" ' Ver si la referencia ya existe en la base de datos BDProSS rsproducto.Open "SELECT * FROM PRODUCTO WHERE ID_PRODUCTO = " & Text1.Text & "", conn, adOpenDynamic, adLockOptimistic If Not rsproducto.EOF = True Then MsgBox "La referencia introducida ya existe en la base de datos", vbExclamation 'cerrar la conexion conn.Close Else If Text1.Text = "" Then MsgBox "Por favor, introduzca una referencia válida para el producto", vbExclamation ElseIf Text3.Text = "" Then MsgBox "Por favor, indique las unidades por utillaje", vbExclamation Else 'paso de contenido a variables globales gproducto.referencia = Text1.Text gproducto.descripcion = Text2.Text gproducto.udsutillaje = Text3.Text Form4.Visible = False Form9.Visible = True End If End If End Sub Private Sub Command2_Click() Form4.Visible = False End Sub Private Sub Form_Load() ' centrar el formulario en la parte superior Move (Screen.Width - Width) \ 2, 1500 End Sub Private Sub Text1_Validate(Cancel As Boolean) If Not IsNumeric(Text1.Text) Then Cancel = True ElseIf CDbl(Text1.Text) < 0 Then Cancel = True End If If Cancel Then MsgBox "Por favor, escriba una referencia válida (0 para cancelar)", vbExclamation End If End Sub Private Sub Text3_Validate(Cancel As Boolean) If Not IsNumeric(Text3.Text) Then Cancel = True ElseIf CDbl(Text3.Text) < 0 Then Cancel = True End If If Cancel Then MsgBox "Por favor, escriba un dato correcto(0 para cancelar)", vbExclamation End If End Sub