Académique Documents
Professionnel Documents
Culture Documents
Unload Me
End Sub
----------------------------------------------------------------------------Private Sub cmdCustomer_Click()
Dim X As Integer
Dim nextrow As Range
On Error GoTo cmdCustomer_Click_Error
Set nextrow = Sheet6.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
For X = 1 To 4
If Me.Controls("Customer" & X).Value = "" Then
MsgBox "You must add Name ,Address ,City and State"
Exit Sub
End If
Next
If WorksheetFunction.CountIf(Sheet6.Range("C:C"), Me.Customer1.Value) > 0 Then
MsgBox "This customer already exists"
Exit Sub
End If
For X = 1 To 9
nextrow = Me.Controls("Customer" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
'clear
For X = 1 To 9
Me.Controls("Customer" & X).Value = ""
Next
On Error GoTo 0
Exit Sub
cmdCustomer_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdCusto
mer_Click of Form frmCustomer"
End Sub
---------------------------------Main Form Menu------------------------------------------Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdCustomer_Click()
NewShowCustomer
End Sub
Private Sub cmdNewProduct_Click()
NewProductShow
End Sub
Private Sub cmdOrders_Click()
NewOrderShow
End Sub
Private Sub cmdReceiving_Click()
ReceivingShow
End Sub
Private Sub cmdVendor_Click()
NewVendorShow
End Sub
-------------------------------------------Add New Product-----------------------------------------------------------------Private Sub cmdAddProduct_Click()
Dim X As Integer
Dim nextrow As Range
On Error GoTo cmdAddProduct_Click_Error
Set nextrow = Sheet5.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0)
For X = 1 To 6
If Me.Controls("Product" & X).Value = "" Then
MsgBox "Missing data"
Exit Sub
End If
Next
If WorksheetFunction.CountIf(Sheet5.Range("E:E"), Me.Product4.Value) > 0 Then
MsgBox "This product code already exists"
Exit Sub
End If
If WorksheetFunction.CountIf(Sheet5.Range("L:L"), Me.Product2.Value) = 0 Then
Select Case MsgBox("This is a new category. It will now be added to the category
list.." _
& vbCrLf & "Are you sure that you want to proceed?" _
, vbYesNo Or vbQuestion Or vbDefaultButton1, "Please check this first")
Case vbYes
Case vbNo
Exit Sub
End Select
Sheet5.Cells(Rows.Count, 12).End(xlUp).Offset(1, 0) = Me.Product2.Value
End If
For X = 1 To 6
nextrow = Me.Controls("Product" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
'clear
For X = 1 To 6
Me.Controls("Product" & X).Value = ""
Next
Sortit
On Error GoTo 0
Exit Sub
cmdAddProduct_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdAddPr
oduct_Click of Form frmNewProduct"
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
--------------------------------------------------Supplier-----------------------------------------------------------------------------------Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdSupplier_Click()
Dim X As Integer
Dim nextrow As Range
On Error GoTo cmdSupplier_Click_Error
Set nextrow = Sheet4.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
For X = 1 To 9
If Me.Controls("Vendor" & X).Value = "" Then
MsgBox "Missing data"
Exit Sub
End If
Next
If WorksheetFunction.CountIf(Sheet4.Range("C:C"), Me.Vendor1.Value) > 0 Then
MsgBox "This Supplier already exists"
Exit Sub
End If
For X = 1 To 9
nextrow = Me.Controls("Vendor" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
'clear
For X = 1 To 9
Me.Controls("Vendor" & X).Value = ""
Next
On Error GoTo 0
Exit Sub
cmdSupplier_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdSuppl
ier_Click of Form frmVendor"
End Sub
-----------------------------------------Receiving----------------------------------------------------------------------------------------Private Sub cmdReceiving_Click()
Dim X As Integer
Dim nextrow As Range
Dim DateCus As Range
On Error GoTo cmdOrders_Click_Error
Me.Arec6.Value
Me.Brec6.Value
Me.Crec6.Value
Me.Drec6.Value
Me.Erec6.Value
Me.Frec6.Value
=
=
=
=
=
=
Format(Me.Arec6.Value,
Format(Me.Brec6.Value,
Format(Me.Crec6.Value,
Format(Me.Drec6.Value,
Format(Me.Erec6.Value,
Format(Me.Frec6.Value,
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
SetmeRec
Recieved
Unload Me
frmReceiving.Show
End If
On Error GoTo 0
Exit Sub
cmdOrders_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdOrder
s_Click of Form frmReceiving"
End Sub
Private Sub crec1_Change()
Dim X As Integer
On Error Resume Next
If Me.Brec3 = "" Then
MsgBox "You must fill in the previous row"
Me.Crec1.Value = ""
Exit Sub
Else
Sheet5.Range("M6").Value = Me.Crec1.Value
Adv
For X = 2 To 6
Me.Controls("Crec" & X).Value = ""
Next
Me.Crec2.RowSource = "Product"
End If
On Error GoTo 0
End Sub
Private Sub Drec1_Change()
Dim X As Integer
On Error Resume Next
If Me.Crec3 = "" Then
MsgBox "You must fill in the previous row"
Me.Drec1.Value = ""
Exit Sub
Else
Sheet5.Range("M6").Value = Me.Drec1.Value
Adv
For X = 2 To 6
Me.Controls("Drec" & X).Value = ""
Next
Me.Drec2.RowSource = "Product"
End If
On Error GoTo 0
End Sub
3, 0)
If Me.Frec3.Value > "" Then Me.Frec6 = Me.Frec3.Value * Me.Frec5.Value
On Error GoTo 0
End Sub
Sub SetmeRec()
Dim DateCus As Range
On Error GoTo SetmeRec_Error
Set DateCus = Sheet3.Cells(Rows.Count, 6).End(xlUp).Offset(0, -1)
DateCus = Val(Me.txtONum)
DateCus.Offset(0, -1) = Me.cboReceiving
DateCus.Offset(0, -2) = Format(Me.txtDate.Value, "d/m/yyyy")
On Error GoTo 0
Exit Sub
SetmeRec_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure SetmeRec
of Form frmReceiving"
End Sub
--------------------------------------------Orders------------------------------------------------------------------------------------------Private Sub cmdOrders_Click()
Dim X As Integer
Dim nextrow As Range
Dim DateCus As Range
On Error GoTo cmdOrders_Click_Error
Me.Arow7.Value
Me.Brow7.Value
Me.Crow7.Value
Me.Drow7.Value
Me.Erow7.Value
Me.Frow7.Value
Me.Grow7.Value
Me.Hrow7.Value
Me.Irow7.Value
Me.Jrow7.Value
=
=
=
=
=
=
=
=
=
=
Format(Me.Arow7.Value,
Format(Me.Brow7.Value,
Format(Me.Crow7.Value,
Format(Me.Drow7.Value,
Format(Me.Erow7.Value,
Format(Me.Frow7.Value,
Format(Me.Grow7.Value,
Format(Me.Hrow7.Value,
Format(Me.Irow7.Value,
Format(Me.Jrow7.Value,
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
"$##,###.00")
Next
End If
Setme
Set nextrow = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(1,
If Me.Brow1.Value > "" Then
For X = 1 To 7
nextrow = Me.Controls("Brow" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
End If
Setme
Set nextrow = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(1,
If Me.Crow1.Value > "" Then
For X = 1 To 7
nextrow = Me.Controls("Crow" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
End If
Setme
Set nextrow = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(1,
If Me.Drow1.Value > "" Then
For X = 1 To 7
nextrow = Me.Controls("Drow" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
End If
Setme
Set nextrow = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(1,
If Me.Erow1.Value > "" Then
For X = 1 To 7
nextrow = Me.Controls("Erow" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
End If
Setme
Set nextrow = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(1,
If Me.Frow1.Value > "" Then
For X = 1 To 7
nextrow = Me.Controls("Frow" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
End If
Setme
Set nextrow = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(1,
If Me.Grow1.Value > "" Then
For X = 1 To 7
nextrow = Me.Controls("Grow" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
End If
Setme
Set nextrow = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(1,
If Me.Hrow1.Value > "" Then
For X = 1 To 7
nextrow = Me.Controls("Hrow" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
End If
Setme
Set nextrow = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(1,
0)
0)
0)
0)
0)
0)
0)
0)
Sub Setme()
Dim DateCus As Range
On Error GoTo Setme_Error
Set DateCus = Sheet2.Cells(Rows.Count, 6).End(xlUp).Offset(0, -1)
DateCus = Val(Me.txtONum)
DateCus.Offset(0, -1) = Me.cboCustomer
DateCus.Offset(0, -2) = Format(Me.txtDate.Value, "d/m/yyyy")
On Error GoTo 0
Exit Sub
Setme_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Setme of
Form frmOrders"
End Sub
---------------------------------------------------Assorted----------------------------------------------------------------------------Sub NewVendorShow()
On Error GoTo NewVendorShow_Error
If frmVendor.Visible = True Then
Unload frmVendor
Else
frmVendor.Show
End If
On Error GoTo 0
Exit Sub
NewVendorShow_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure NewVendo
rShow of Module Assorted"
End Sub
Sub NewShowCustomer()
On Error GoTo NewShowCustomer_Error
If frmCustomer.Visible = True Then
Unload frmCustomer
Else
frmCustomer.Show
End If
On Error GoTo 0
Exit Sub
NewShowCustomer_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure NewShowC
ustomer of Module Assorted"
End Sub
Sub NewProductShow()
On Error GoTo NewProductShow_Error
If frmNEwProduct.Visible = True Then
Unload frmNEwProduct
Else
frmNEwProduct.Show
End If
On Error GoTo 0
Exit Sub
NewProductShow_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure NewProdu
ctShow of Module Assorted"
End Sub
Sub Sortit()
On Error GoTo Sortit_Error
Application.ScreenUpdating = False
returnto = ActiveSheet.Name
Sheet5.Activate
With Sheet5
Sheet5.Range("B6:G10000").Sort Key1:=Range("C5"), Order1:=xlAscending, Header:=x
lGuess
End With
ThisWorkbook.Sheets(returnto).Select
On Error GoTo 0
Exit Sub
Sortit_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Sort
it of Module Assorted"
End Sub
Sub ReceivingShow()
On Error GoTo ReceivingShow_Error
If frmReceiving.Visible = True Then
Unload frmReceiving
Else
frmReceiving.Show
End If
On Error GoTo 0
Exit Sub
ReceivingShow_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Receivin
gShowof Module Assorted"
End Sub
Sub Adv()
On Error GoTo Adv_Error
Sheet5.Range("Cat_Full").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=She
et5.Range( _
"M5:M6"), CopyToRange:=Sheet5.Range("N5:O5"), Unique:=False
On Error GoTo 0
Exit Sub
Adv_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Adv of M
odule Assorted"
End Sub
Sub Recieved()
On Error GoTo Recieved_Error
Dim returnto
Application.ScreenUpdating = False
returnto = ActiveSheet.Name
Sheet3.Activate
With Sheet3
Sheet3.Range("G6:G" & Cells(Rows.Count, "G").End(xlUp).Row).Name = "AllReceived"
Sheet3.Range("H6:H" & Cells(Rows.Count, "H").End(xlUp).Row).Name = "RecievedTot"
End With
ThisWorkbook.Sheets(returnto).Select
On Error GoTo 0
Exit Sub
Recieved_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Recieved
of Module Assorted"
End Sub
Sub Ordered()
On Error GoTo Ordered_Error
Application.ScreenUpdating = False
returnto = ActiveSheet.Name
Sheet2.Activate
With Sheet2
.Range("G6:L" & Cells(Rows.Count, "G").End(xlUp).Row).Name = "Items"
.Range("G6:G" & Cells(Rows.Count, "G").End(xlUp).Row).Name = "AllProducts"
.Range("H6:H" & Cells(Rows.Count, "H").End(xlUp).Row).Name = "AllOrdered"
End With
ThisWorkbook.Sheets(returnto).Select
On Error GoTo 0
Exit Sub
Ordered_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Ordered
of Module Assorted"
End Sub
Sub NewOrderShow()
=------------------------------------------------Name Manager-------------------------------------------------------------------------Data
=OFFSET(Products!$D$6,,,COUNTA(Products!$D$6:$D$2000),6)
Extract
Date Customer Total
==Interface!$L$24:$N$24
Extract
Category Product
=Products!$N$5:$O$5
Items
==Orders!$G$6:$L$127
Product
==OFFSET(Products!$O$6,,,COUNTA(Products!$O$6:$O$10000))
ReceivedTot
=Recieving!$H$6:$H$14
Reorder
=OFFSET(Products!$J$6,,,COUNTA(Products!$J$6:$J$1000))
Suppliers
=OFFSET(Supplier!$C$6,,,COUNTA(Supplier!$C$6:$C$1000))
Customer
==OFFSET(Customers!$C$6,,,COUNTA(Customers!$C$6:$C$1000))
ChartTotal
==OFFSET(Interface!$N$25,,,COUNTA(Interface!$N$25:$N$1000))
ChartDate
==OFFSET(Interface!$L$25,,,COUNTA(Interface!$L$25:$L$1000))
Category
==OFFSET(Products!$L$6,,,COUNTA(Products!$L$6:$L$100))
Cat_Validation
=OFFSET(Products!$C$6,,,COUNTA(Products!$C$6:$C$10000))
Cat_full
=OFFSET(Products!$C$5,,,COUNTA(Products!$C$5:$C$20000),2)
Cascade
=Products!$D$5
AllReceived
=Recieving!$G$6:$G$14
AllProducts
=Orders!$G$6:$G$127
AllOrdered
=Orders!$H$6:$H$127