VERSION 5.00
Begin VB.Form manufacture 
   BackColor       =   &H00C0C0FF&
   Caption         =   "Enter Manufactured Product"
   ClientHeight    =   2835
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4980
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2835
   ScaleWidth      =   4980
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txt_mfg_date 
      BeginProperty DataFormat 
         Type            =   1
         Format          =   "d. M. yyyy"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   1033
         SubFormatType   =   3
      EndProperty
      Height          =   375
      Left            =   1800
      TabIndex        =   6
      Top             =   720
      Width           =   1575
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Add"
      Height          =   375
      Left            =   1800
      TabIndex        =   5
      Top             =   2280
      Width           =   1575
   End
   Begin VB.TextBox txt_qty 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   1800
      TabIndex        =   3
      Top             =   1200
      Width           =   1575
   End
   Begin VB.TextBox txt_prod_code 
      Height          =   285
      Left            =   1800
      TabIndex        =   1
      Top             =   360
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Browse Product"
      Height          =   255
      Left            =   3480
      TabIndex        =   0
      Top             =   360
      Width           =   1335
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0FF&
      Caption         =   "Manufacturing Date"
      Height          =   195
      Left            =   240
      TabIndex        =   7
      Top             =   840
      Width           =   1410
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0FF&
      Caption         =   "Quantity"
      Height          =   195
      Left            =   240
      TabIndex        =   4
      Top             =   1440
      Width           =   585
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00C0C0FF&
      Caption         =   "Product Code"
      Height          =   195
      Left            =   240
      TabIndex        =   2
      Top             =   360
      Width           =   975
   End
End
Attribute VB_Name = "manufacture"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
manufacture.Enabled = False
prod1.Show
End Sub

Private Sub Command2_Click()


If txt_prod_code.Text = "" Or txt_mfg_date.Text = "" Or txt_qty.Text = "" Then
    MsgBox "Fields Empty"
    Exit Sub
End If

con.Open "DSN=sega"
Dim rs As New ADODB.Recordset

rs.Open "select * from product where prod_code ='" & Trim(txt_prod_code.Text) & "'", con, adOpenStatic, adLockOptimistic


If rs.EOF <> True Then
    rs.Close


   rs.Open "select * from manufacturing", con, adOpenStatic, adLockOptimistic
    'rs.MoveLast
    rs.AddNew
    rs!prod_code = txt_prod_code.Text
    rs!mfg_date = txt_mfg_date.Text
    rs!qty = txt_qty.Text
    rs.Update
    rs.Close
        
    rs.Open "select * from product where prod_code ='" & Trim(txt_prod_code.Text) & "'", con, adOpenStatic, adLockOptimistic
    rs!prod_qty = CInt(rs!prod_qty) + CInt(txt_qty.Text)
    rs.Update
    MsgBox "record added"
    rs.Close
Else

    MsgBox "product does not exists"

End If

con.Close


End Sub

Private Sub Form_Unload(Cancel As Integer)
Unload Me
mainform.Enabled = True

End Sub
