APPENDIX: Visual Basic Source Code
Rem *******************************************
Rem *
Rem * Software Engineering CEN 4020
Rem * Term Project (Spring 2001)
Rem *
Rem * BMW Sedan Tracking System (BSTS)
Rem *
Rem * all design, coding, and documentation
Rem * by Philip J. Porvaznik
Rem *
Rem *******************************************
Rem
Rem
Rem *********************************
Rem *
Rem * Code for BMW Inventory Form
Rem *
Rem * by Philip J. Porvaznik
Rem *
Rem *********************************
Private Sub cmdAddCar_Click()
Rem *************************
Rem *
Rem * Add new car data to
Rem * Inventory database
Rem *
Rem *************************
txtTrackCodeInv.SetFocus
BMWInventory.Recordset.AddNew
End Sub
Private Sub cmdSearchCars_Click()
Rem **************************************
Rem *
Rem * Close BMW Inventory form and
Rem * make Search Inventory form visible
Rem *
Rem **************************************
frmBMWInventory.Visible = False
frmSearchInventory.Visible = True
frmSearchInventory.txtSTrack.SetFocus
End Sub
Private Sub cmdSSearch_Click()
Rem *******************************************
Rem *
Rem * Close BMW Inventory form and
Rem * make SSearch (small search) form visible
Rem *
Rem *******************************************
frmBMWInventory.Visible = False
frmSSearch.Visible = True
frmSSearch.txtSTrack.SetFocus
End Sub
Private Sub cmdShowDetail_Click()
Rem ******************************
Rem *
Rem * Call Show Detail sub
Rem * with current car data
Rem *
Rem ******************************
Call ShowDetail
End Sub
Private Sub cmdSellThisCar_Click()
Rem ******************************
Rem *
Rem * Sell current car by
Rem * adding blank record with
Rem * current Track Code to the
Rem * Sales database
Rem *
Rem ******************************
Dim newTrackCode As String
newTrackCode = txtTrackCodeInv
Rem * Increase the total sold for this car by 1
txtTotalSold = Str(Val(txtTotalSold) + 1)
Rem * make BMW Sales form visible
frmBMWInventory.Visible = False
frmBMWSales.Visible = True
Rem * Add a blank record to Sales using
Rem * the Track Code for this car from Inventory
frmBMWSales.BMWSales.Recordset.AddNew
frmBMWSales.txtTrackCodeSales = newTrackCode
frmBMWSales.txtFirstName.SetFocus
End Sub
Private Sub cmdDeleteCar_Click()
Rem ****************************
Rem *
Rem * Delete current car from
Rem * Inventory database
Rem *
Rem ****************************
If BMWInventory.Recordset.RecordCount > 0 And (MsgBox("Are you sure you want to delete
this car?", vbYesNo, "Confirm Delete Car")) = vbYes Then
BMWInventory.Recordset.Delete
BMWInventory.Recordset.MoveNext
End If
End Sub
Private Sub cmdIncStock_Click()
Rem ****************************
Rem *
Rem * Increase by 1 the
Rem * In Stock for this car
Rem *
Rem ****************************
Dim i As Double
i = Val(txtInStock) + 1
txtInStock = Str(i)
End Sub
Private Sub cmdDecStock_Click()
Rem ****************************
Rem *
Rem * Decrease by 1 the
Rem * In Stock for this car
Rem *
Rem ****************************
Dim i As Double
i = Val(txtInStock) - 1
If i < 0 Then i = 0
txtInStock = Str(i)
End Sub
Private Sub cmdIncOrder_Click()
Rem ****************************
Rem *
Rem * Increase by 1 the
Rem * On Order for this car
Rem *
Rem ****************************
Dim i As Double
i = Val(txtOnOrder) + 1
txtOnOrder = Str(i)
End Sub
Private Sub cmdDecOrder_Click()
Rem ****************************
Rem *
Rem * Decrease by 1 the
Rem * On Order for this car
Rem *
Rem ****************************
Dim i As Double
i = Val(txtOnOrder) - 1
If i < 0 Then i = 0
txtOnOrder = Str(i)
End Sub
Private Sub cmdManageSales_Click()
Rem ********************************
Rem *
Rem * Close BMW Inventory form and
Rem * make Sales form visible
Rem *
Rem ********************************
frmBMWInventory.Visible = False
frmBMWSales.Visible = True
End Sub
Private Sub cmdCloseExit_Click()
Rem ********************************
Rem *
Rem * Close all databases
Rem *
Rem * unload all forms and exit
Rem *
Rem ********************************
Unload frmBMWSales
Unload frmDisplayDetail
Unload frmSSearch
Unload frmSearchInventory
Unload frmSearchSales
Unload Me
End Sub
Private Sub ShowDetail()
Rem ***************************************
Rem *
Rem * Shows detail of current car
Rem *
Rem ***************************************
Dim Engine As String, Trans As String, HandCap As String, InstCon As String, SafSec As String
Dim Tire As String, ExtDesign As String, IntDesign As String, Audio As String
Dim ComfConv As String, Maint As String, Warr As String, Extra As String
Dim InStock As String, OnOrder As String, TotalSold As String
Dim i As Integer
Dim DetailString As String
Dim nl As String
Rem * nl is the new line character, DetailString is the full string output
nl = vbNewLine
Rem **********************************
Rem *
Rem * Get Track Code and Model Number
Rem *
Rem **********************************
DetailString = "TRACK CODE = " + txtTrackCodeInv + nl + "MODEL NUMBER = " +
txtModelNumber + nl
Rem ******************************
Rem *
Rem * Determine Engine Type
Rem *
Rem ******************************
Engine = nl + "ENGINE TYPE" + nl
Select Case txtEngine
Case "A"
Engine = Engine + "A=2.5 liter DOHC 24 valve in-line 6 cyl"
Case "B"
Engine = Engine + "B=2.8 liter DOHC 193 hp 24 valve in-line 6 cyl"
Case "C"
Engine = Engine + "C=4.4 liter light alloy 282 hp 32 valve V8 with 4 overhead cam"
Case "D"
Engine = Engine + "D=5.4 liter light alloy V12 with 2 overhead cam"
Case "X"
Engine = Engine + "X=other"
End Select
Engine = Engine + nl
Rem ******************************
Rem *
Rem * Determine Transmission Type
Rem *
Rem ******************************
Trans = nl + "TRANSMISSION TYPE" + nl
Select Case txtTrans
Case "A"
Trans = Trans + "A=5-speed manual trans with direct 5th geat"
Case "B"
Trans = Trans + "B=5-speed steptronic dual-mode (auto/clutchless manual)"
Case "C"
Trans = Trans + "C=5-speed manual trans"
Case "D"
Trans = Trans + "D=4-speed auto trans"
Case "E"
Trans = Trans + "E=4-speed auto trans with ATC"
Case "X"
Trans = Trans + "X=other"
End Select
Trans = Trans + nl
Rem ***************************************
Rem *
Rem * Determine Handling/Capability Types
Rem *
Rem ***************************************
HandCap = nl + "HANDLING/CAPABILITY TYPE" + nl
For i = 1 To Len(txtHandCap)
Select Case Mid(txtHandCap, i, 1)
Case "A"
HandCap = HandCap + "A=strut-type front susp with forged-alum lower arms hydr cush"
Case "B"
HandCap = HandCap + "B=multi-link rear susp with cast-alum upper transv arms"
Case "C"
HandCap = HandCap + "C=front/rear anti-roll stabil bars"
Case "D"
HandCap = HandCap + "D=twin-tube gas-press shock absorb"
Case "E"
HandCap = HandCap + "E=sport susp calib"
Case "F"
HandCap = HandCap + "F=all-season tract"
Case "G"
HandCap = HandCap + "G=all-season tires"
Case "H"
HandCap = HandCap + "H=Dynamic Stability Control (DSC)"
Case "I"
HandCap = HandCap + "I=Dynamic Brake Control (DBC)"
Case "J"
HandCap = HandCap + "J=engine-speed sensitive var assist power steer"
Case "K"
HandCap = HandCap + "K=four-wheel vent disc brakes"
Case "L"
HandCap = HandCap + "L=four-wheel vent anti-lock disc brakes with elec front/rear prop"
Case "M"
HandCap = HandCap + "M=M Technic sport susp"
Case "N"
HandCap = HandCap + "N=self-level rear susp"
Case "X"
HandCap = HandCap + "X=other"
End Select
HandCap = HandCap + nl
Next i
Rem ********************************************
Rem *
Rem * Determine Instrumentation/Controls Types
Rem *
Rem ********************************************
InstCon = nl + "INSTRUMENTATION/CONTROLS TYPE" + nl
For i = 1 To Len(txtInstCon)
Select Case Mid(txtInstCon, i, 1)
Case "A"
InstCon = InstCon + "A=service interval indicator with miles-to-service readout"
Case "B"
InstCon = InstCon + "B=check control vehicle monitor system with pictogram"
Case "C"
InstCon = InstCon + "C=4-function on-board computer"
Case "D"
InstCon = InstCon + "D=integrated on-board navigation"
Case "E"
InstCon = InstCon + "E=external temp display"
Case "X"
InstCon = InstCon + "X=other"
End Select
InstCon = InstCon + nl
Next i
Rem ***********************************
Rem *
Rem * Determine Safety/Security Types
Rem *
Rem ***********************************
SafSec = nl + "SAFETY/SECURITY TYPE" + nl
For i = 1 To Len(txtSafSec)
Select Case Mid(txtSafSec, i, 1)
Case "A"
SafSec = SafSec + "A=anti-lock braking system (ABS)"
Case "B"
SafSec = SafSec + "B=Head Protection System (HPS)"
Case "C"
SafSec = SafSec + "C=Driver and passenger front airbag suppl restraint system (SRS)"
Case "D"
SafSec = SafSec + "D=front-door-mounted side-impact airbags"
Case "E"
SafSec = SafSec + "E=interlocking door anchoring system"
Case "F"
SafSec = SafSec + "F=Battery Safety Terminal (BSF)"
Case "G"
SafSec = SafSec + "G=auto fuel cut-off"
Case "H"
SafSec = SafSec + "H=central double-lock system with console switch"
Case "I"
SafSec = SafSec + "I=Coded Driveaway Protection"
Case "J"
SafSec = SafSec + "J=Height adjust front safety belts with auto tension"
Case "K"
SafSec = SafSec + "K=Rollover Protection System (RPS)"
Case "L"
SafSec = SafSec + "L=Auto Lock Retract (ALR)"
Case "M"
SafSec = SafSec + "M=Crash sensor turns on hazard/int lights and unlocks doors"
Case "N"
SafSec = SafSec + "N=Remote entry and security system"
Case "X"
SafSec = SafSec + "X=other"
End Select
SafSec = SafSec + nl
Next i
Rem ******************************
Rem *
Rem * Determine Tire/Wheels Type
Rem *
Rem ******************************
Tire = nl + "TIRE/WHEELS TYPE" + nl
Select Case txtTire
Case "A"
Tire = Tire + "A=15 x 6.5 alloy 195/65R 15 91H all-season"
Case "B"
Tire = Tire + "B=16 x 7.0 V spoke 205/55R 16 91H all-season"
Case "C"
Tire = Tire + "C=17 x 8.0 Star spoke 225/45R 17 91W perform"
Case "D"
Tire = Tire + "D=15 x 7 alloy 205/60R 15 all-season"
Case "E"
Tire = Tire + "E=16 x 7 alloy 225/50R 16 perform"
Case "F"
Tire = Tire + "F=15 / alloy 225/60R 15 all-season"
Case "G"
Tire = Tire + "G=16 / cross spoke 225/55R 16 all-season"
Case "H"
Tire = Tire + "H=16 / 20 spoke alloy 225/55R 16 all-season"
Case "I"
Tire = Tire + "I=17 / cross spoke bolted alloy 235/45R 17 perform"
Case "J"
Tire = Tire + "J=17 / radial style alloy 235/45R 17 perform"
Case "K"
Tire = Tire + "K=16 x 7.5 ellipsoid style alloy 235/60R all-season"
Case "L"
Tire = Tire + "L=16 x 7.5 radial spoke alloy 235/60R 16 all-season"
Case "M"
Tire = Tire + "M=18 x 8.0 front 235/50ZR 18 x 9.5 rear 255/45ZR 18 par spoke
alloy with perform"
Case "N"
Tire = Tire + "N=17 x 8.0 alloy 235/55R 17 all-season run-flat tires"
Case "X"
Tire = Tire + "X=other"
End Select
Tire = Tire + nl
Rem ***********************************
Rem *
Rem * Determine Exterior Design Types
Rem *
Rem ***********************************
ExtDesign = nl + "EXTERIOR DESIGN TYPE" + nl
For i = 1 To Len(txtExtDesign)
Select Case Mid(txtExtDesign, i, 1)
Case "A"
ExtDesign = ExtDesign + "A=Metallic Paint"
Case "B"
ExtDesign = ExtDesign + "B=Halogen free-form foglights"
Case "C"
ExtDesign = ExtDesign + "C=Xenon low-beam headlights with auto-level"
Case "D"
ExtDesign = ExtDesign + "D=heated windshield-washer jets and mirrors"
Case "E"
ExtDesign = ExtDesign + "E=heated door mirrors"
Case "F"
ExtDesign = ExtDesign + "F=Park Distance (PDC)"
Case "X"
ExtDesign = ExtDesign + "X=other"
End Select
ExtDesign = ExtDesign + nl
Next i
Rem ************************************
Rem *
Rem * Determine Interior Design Types
Rem *
Rem ************************************
IntDesign = nl + "INTERIOR DESIGN TYPE" + nl
For i = 1 To Len(txtIntDesign)
Select Case Mid(txtIntDesign, i, 1)
Case "A"
IntDesign = IntDesign + "A=6-way power front seats"
Case "B"
IntDesign = IntDesign + "B=10-way power front seats with power headrests"
Case "C"
IntDesign = IntDesign + "C=10-way adjust front sport seats"
Case "D"
IntDesign = IntDesign + "D=8-way power 2-way manual front sport seats"
Case "E"
IntDesign = IntDesign + "E=14-way power front seats with lumbar support"
Case "F"
IntDesign = IntDesign + "F=16-way comfort seats with lumbar and upper backrest"
Case "G"
IntDesign = IntDesign + "G=3-position driver seat memory"
Case "H"
IntDesign = IntDesign + "H=Leatherette upholstery"
Case "I"
IntDesign = IntDesign + "I=Montana leather upholstery"
Case "J"
IntDesign = IntDesign + "J=genuine leather upholstery"
Case "K"
IntDesign = IntDesign + "K=front and rear adjust headrests"
Case "L"
IntDesign = IntDesign + "L=2-stage thermo control heated front seats"
Case "M"
IntDesign = IntDesign + "M=genuine Myrtle wood trim"
Case "N"
IntDesign = IntDesign + "N=high-gloss trim"
Case "X"
IntDesign = IntDesign + "X=other"
End Select
IntDesign = IntDesign + nl
Next i
Rem ******************************
Rem *
Rem * Determine Audio Type
Rem *
Rem ******************************
Audio = nl + "AUDIO TYPE" + nl
Select Case txtAudio
Case "A"
Audio = Audio + "A=anti-theft AM/FM stereo/cassette with 10 speakers"
Case "B"
Audio = Audio + "B=Harmon Kardon audio system with 12 speakers"
Case "C"
Audio = Audio + "C=In-dash CD player in place of cassette"
Case "X"
Audio = Audio + "X=other"
End Select
Audio = Audio + nl
Rem ***************************************
Rem *
Rem * Determine Comfort/Convenience Types
Rem *
Rem ***************************************
ComfConv = nl + "COMFORT/CONVENIENCE TYPE" + nl
For i = 1 To Len(txtComfConv)
Select Case Mid(txtComfConv, i, 1)
Case "A"
ComfConv = ComfConv + "A=auto a/c and air recir"
Case "B"
ComfConv = ComfConv + "B=auto climate control"
Case "C"
ComfConv = ComfConv + "C=dual digital auto climate with micro-filter vent"
Case "D"
ComfConv = ComfConv + "D=Car and Key Memory"
Case "E"
ComfConv = ComfConv + "E=keyless entry with multi-func remote"
Case "F"
ComfConv = ComfConv + "F=2-way power glass moonroof with slid int sunshade wind def"
Case "G"
ComfConv = ComfConv + "G=tilt-telescopic steering"
Case "H"
ComfConv = ComfConv + "H=auto-dim inside rear-view mirror"
Case "I"
ComfConv = ComfConv + "I=power front and rear windows"
Case "J"
ComfConv = ComfConv + "J=cruise control"
Case "K"
ComfConv = ComfConv + "K=dual power heated outside mirrors"
Case "L"
ComfConv = ComfConv + "L=electric int trunk release"
Case "M"
ComfConv = ComfConv + "M=pre-wiring for cell phone/alarm/garage door open"
Case "N"
ComfConv = ComfConv + "N=Ambiance Lighting"
Case "X"
ComfConv = ComfConv + "X=other"
End Select
ComfConv = ComfConv + nl
Next i
Rem **************************************
Rem *
Rem * Determine Maintenance Program Type
Rem *
Rem **************************************
Maint = nl + "MAINTENANCE PROGRAM TYPE" + nl
Select Case txtMaint
Case "A"
Maint = Maint + "A=4 year/50000 miles"
Case "B"
Maint = Maint + "B=3 year/36000 miles"
Case ""
Maint = Maint + "none"
Case "X"
Maint = Maint + "X=other"
End Select
Maint = Maint + nl
Rem ***********************************
Rem *
Rem * Determine Warranty Program Type
Rem *
Rem ***********************************
Warr = nl + "WARRANTY PROGRAM TYPE" + nl
Select Case txtWarr
Case "A"
Warr = Warr + "A=4 year/50000 miles"
Case "B"
Warr = Warr + "B=3 year/36000 miles"
Case ""
Warr = Warr + "none"
Case "X"
Warr = Warr + "X=other"
End Select
Warr = Warr + nl
Rem ********************************
Rem *
Rem * Determine Extra Package Type
Rem *
Rem ********************************
Extra = nl + "EXTRA PACKAGE TYPE" + nl
Select Case txtExtra
Case "A"
Extra = Extra + "A=premium"
Case "B"
Extra = Extra + "B=sport"
Case "C"
Extra = Extra + "C=premium-sport"
Case ""
Extra = Extra + "none"
Case "X"
Extra = Extra + "X=other"
End Select
Extra = Extra + nl
Rem *************************************
Rem *
Rem * Get InStock, OnOrder, TotalSold
Rem *
Rem *************************************
InStock = nl + "IN STOCK = " + txtInStock + nl
OnOrder = "ON ORDER = " + txtOnOrder + nl
TotalSold = "TOTAL SOLD = " + txtTotalSold + nl
Rem *********************************************
Rem *
Rem * Make Car Detail form visible and
Rem * display the full Detail String
Rem *
Rem *********************************************
DetailString = DetailString + Engine + Trans + HandCap + InstCon + SafSec + Tire + ExtDesign
+ IntDesign + Audio + ComfConv + Maint + Warr + Extra + InStock + OnOrder + TotalSold
frmBMWInventory.Visible = False
frmDisplayDetail.Visible = True
frmDisplayDetail.txtDetail = DetailString
End Sub
Rem ****************************
Rem *
Rem * Code for BMW Sales form
Rem *
Rem * by Philip J. Porvaznik
Rem *
Rem ****************************
Private Sub cmdAddSale_Click()
Rem ***************************
Rem *
Rem * Add new sale to
Rem * Sales database
Rem *
Rem ***************************
txtTrackCodeSales.SetFocus
BMWSales.Recordset.AddNew
End Sub
Private Sub cmdDeleteSale_Click()
Rem ******************************
Rem *
Rem * Delete current sale from
Rem * Sales database
Rem *
Rem ******************************
If BMWSales.Recordset.RecordCount > 0 And (MsgBox("Are you sure you want to delete
this sale?", vbYesNo, "Confirm Delete Sale")) = vbYes Then
BMWSales.Recordset.Delete
BMWSales.Recordset.MoveNext
End If
End Sub
Private Sub cmdSearchSales_Click()
Rem **************************************
Rem *
Rem * Close BMW Sales form and
Rem * make Search Sales form visible
Rem *
Rem **************************************
frmBMWSales.Visible = False
frmSearchSales.Visible = True
frmSearchSales.txtSFirst.SetFocus
End Sub
Private Sub cmdManageInventory_Click()
Rem ***********************************
Rem *
Rem * Close Sales form and
Rem * make Inventory form visible
Rem *
Rem ***********************************
frmBMWSales.Visible = False
frmBMWInventory.Visible = True
End Sub
Private Sub cmdCloseExit_Click()
Rem *****************************
Rem *
Rem * Close all databases
Rem * unload program and exit
Rem *
Rem *****************************
Unload frmBMWInventory
Unload frmDisplayDetail
Unload frmSSearch
Unload frmSearchInventory
Unload frmSearchSales
Unload Me
End Sub
Rem *******************************
Rem *
Rem * Code for Display Detail form
Rem *
Rem *******************************
Private Sub cmdDone_Click()
Rem *********************************
Rem *
Rem * When Done Button Pressed
Rem * Close Display Detail form
Rem * and make BMWInventory visible
Rem *
Rem *********************************
frmDisplayDetail.Visible = False
frmBMWInventory.Visible = True
End Sub
Rem **********************************
Rem *
Rem * Code for Search Inventory form
Rem *
Rem * by Philip J. Porvaznik
Rem *
Rem **********************************
Dim FoundIndex(100) As Integer ' allow for 100 matches found
Dim TotalMatches As Integer ' total number of matches
Private Sub cmdClear_Click()
Rem ********************************
Rem *
Rem * Clear the form for new search
Rem *
Rem ********************************
txtSTrack = ""
txtSModel = ""
txtSEngine = ""
txtSTrans = ""
txtSHand = ""
txtSInst = ""
txtSSaf = ""
txtSTire = ""
txtSExt = ""
txtSInt = ""
txtSAudio = ""
txtSComf = ""
txtSMaint = ""
txtSWarr = ""
txtSExtra = ""
txtSTrack.SetFocus
With grdSearch
.Clear
.Rows = 1
End With
End Sub
Private Sub cmdDone_Click()
Rem ********************************
Rem *
Rem * Done with search
Rem *
Rem * Close Search Inventory form
Rem * Return to BMW Inventory form
Rem *
Rem ********************************
frmSearchInventory.Visible = False
frmBMWInventory.Visible = True
End Sub
Private Sub cmdSearch_Click()
Rem **********************************
Rem *
Rem * Search sequentially through
Rem * the BMW Inventory database
Rem * using the criteria specified
Rem * in the Search Inventory fields
Rem *
Rem **********************************
Dim i As Integer, YesMatch As Boolean, tb As String, DetailString As String
Dim Track As String, Model As String, Engine As String, Hand As String, Inst As String
Dim Saf As String, Tire As String, ExtD As String, IntD As String, Audio As String
Dim Comf As String, Maint As String, Warr As String, Extra As String
tb = vbTab ' set up tab key for display
With grdSearch ' set up MS Flex Grid for headings
.Clear
.TextMatrix(0, 0) = "Track"
.TextMatrix(0, 1) = "Model"
.TextMatrix(0, 2) = "Engine"
.TextMatrix(0, 3) = "Trans"
.TextMatrix(0, 4) = "Hand Cap"
.TextMatrix(0, 5) = "Inst Con"
.TextMatrix(0, 6) = "Saf Sec"
.TextMatrix(0, 7) = "Tire"
.TextMatrix(0, 8) = "Ext Design"
.TextMatrix(0, 9) = "Int Design"
.TextMatrix(0, 10) = "Audio"
.TextMatrix(0, 11) = "Comf Conv"
.TextMatrix(0, 12) = "Maint"
.TextMatrix(0, 13) = "Warr"
.TextMatrix(0, 14) = "Extra"
.Rows = 1
End With
TotalMatches = 0 ' set total number of matches to zero
BMWInventory.Recordset.MoveFirst ' go to the first record in Inventory database
For i = 1 To BMWInventory.Recordset.RecordCount ' search sequentially thru Inventory
Track = BMWInventory.Recordset.Fields("TrackCode")
Model = BMWInventory.Recordset.Fields("ModelNumber")
Engine = BMWInventory.Recordset.Fields("EngineType")
Trans = BMWInventory.Recordset.Fields("TransType")
Hand = BMWInventory.Recordset.Fields("HandCapType")
Inst = BMWInventory.Recordset.Fields("InstConType")
Saf = BMWInventory.Recordset.Fields("SafSecType")
Tire = BMWInventory.Recordset.Fields("TireType")
ExtD = BMWInventory.Recordset.Fields("ExtDesignType")
IntD = BMWInventory.Recordset.Fields("IntDesignType")
Audio = BMWInventory.Recordset.Fields("AudioType")
Comf = BMWInventory.Recordset.Fields("ComfConvType")
Maint = BMWInventory.Recordset.Fields("MaintProgType")
Warr = BMWInventory.Recordset.Fields("WarrProgType")
Extra = BMWInventory.Recordset.Fields("ExtraType")
YesMatch = True ' set match test state to True
Rem * check all fields for match, ignore if left blank
If txtSTrack <> "" And txtSTrack <> Track Then YesMatch = False
If txtSModel <> "" And txtSModel <> Model Then YesMatch = False
If txtSEngine <> "" And txtSEngine <> Engine Then YesMatch = False
If txtSTrans <> "" And txtSTrans <> Trans Then YesMatch = False
If txtSHand <> "" And txtSHand <> Hand Then YesMatch = False
If txtSInst <> "" And txtSInst <> Inst Then YesMatch = False
If txtSSaf <> "" And txtSSaf <> Saf Then YesMatch = False
If txtSTire <> "" And txtSTire <> Tire Then YesMatch = False
If txtSExt <> "" And txtSExt <> ExtD Then YesMatch = False
If txtSInt <> "" And txtSInt <> IntD Then YesMatch = False
If txtSAudio <> "" And txtSAudio <> Audio Then YesMatch = False
If txtSComf <> "" And txtSComf <> Comf Then YesMatch = False
If txtSMaint <> "" And txtSMaint <> Maint Then YesMatch = False
If txtSWarr <> "" And txtSWarr <> Warr Then YesMatch = False
If txtSExtra <> "" And txtSExtra <> Extra Then YesMatch = False
Rem * do we have a match? if so, add it to MS Flex Grid display
If YesMatch And TotalMatches < 100 Then
DetailString = Track + tb + Model + tb + Engine + tb + Trans + tb + Hand + tb +
Inst + tb + Saf + tb + Tire + tb + ExtD + tb + IntD + tb + Audio + tb +
Comf + tb + Maint + tb + Warr + tb + Extra
grdSearch.AddItem (DetailString)
Rem * add current match to the Found array
TotalMatches = TotalMatches + 1
' FoundIndex(TotalMatches) = BMWInventory.Recordset.AbsolutePosition
End If
Rem * move forward one record
BMWInventory.Recordset.MoveNext
Next i
If TotalMatches = 0 Then MsgBox ("Sorry no matches found for these criteria, click OK")
End Sub
Rem *******************************
Rem *
Rem * Code for Search Sales form
Rem *
Rem * by Philip J. Porvaznik
Rem *
Rem *******************************
Dim FoundIndex(500) As Integer ' allow for 500 matches found
Dim TotalMatches As Integer ' total number of matches
Private Sub cmdClear_Click()
Rem ********************************
Rem *
Rem * Clear the form for new search
Rem *
Rem ********************************
txtSFirst = ""
txtSMid = ""
txtSLast = ""
txtSPhone = ""
txtSDate = ""
txtSAddr1 = ""
txtSAddr2 = ""
txtSCity = ""
txtSState = ""
txtSZip = ""
txtSFirst.SetFocus
With grdSearch
.Clear
.Rows = 1
End With
End Sub
Private Sub cmdDone_Click()
Rem ***********************************
Rem *
Rem * Done with Search
Rem *
Rem * Close Search Sales form
Rem * Return to BMW Sales form
Rem *
Rem ***********************************
frmSearchSales.Visible = False
frmBMWSales.Visible = True
End Sub
Private Sub cmdSearch_Click()
Rem ************************************
Rem *
Rem * Search sequentially through
Rem * the BMW Sales database
Rem * using the criteria specified
Rem * in the Search Sales fields
Rem *
Rem ************************************
Dim i As Integer, YesMatch As Boolean, tb As String, DetailString As String
Dim Track As String, First As String, Middle As String, Last As String
Dim Addr1 As String, Addr2 As String, City As String, State As String
Dim Zip As String, Phone As String, Sold As String
tb = vbTab ' set up tab key for display
With grdSearch ' set up MS Flex Grid for headings
.Clear
.TextMatrix(0, 0) = "Track"
.TextMatrix(0, 1) = "First"
.TextMatrix(0, 2) = "Mid"
.TextMatrix(0, 3) = "Last"
.TextMatrix(0, 4) = "Address 1"
.TextMatrix(0, 5) = "Address 2"
.TextMatrix(0, 6) = "City"
.TextMatrix(0, 7) = "State"
.TextMatrix(0, 8) = "Zip"
.TextMatrix(0, 9) = "Phone"
.TextMatrix(0, 10) = "Sold"
.Rows = 1
End With
TotalMatches = 0 ' set total number of matches to zero
BMWSales.Recordset.MoveFirst ' go to the first record in Sales database
For i = 1 To BMWSales.Recordset.RecordCount ' search sequentially thru Sales
Track = BMWSales.Recordset.Fields("TrackCode")
First = BMWSales.Recordset.Fields("CustNameFirst")
Middle = BMWSales.Recordset.Fields("CustNameMid")
Last = BMWSales.Recordset.Fields("CustNameLast")
Addr1 = BMWSales.Recordset.Fields("CustAddr1")
Addr2 = BMWSales.Recordset.Fields("CustAddr2")
City = BMWSales.Recordset.Fields("CustCity")
State = BMWSales.Recordset.Fields("CustState")
Zip = BMWSales.Recordset.Fields("CustZipCode")
Phone = BMWSales.Recordset.Fields("CustPhone")
Sold = BMWSales.Recordset.Fields("DateSold")
YesMatch = True ' set match test state to True
Rem * check all fields for match, ignore if left blank
If txtSFirst <> "" And txtSFirst <> First Then YesMatch = False
If txtSMid <> "" And txtSMid <> Middle Then YesMatch = False
If txtSLast <> "" And txtSLast <> Last Then YesMatch = False
If txtSAddr1 <> "" And txtSAddr1 <> Addr1 Then YesMatch = False
If txtSAddr2 <> "" And txtSAddr2 <> Addr2 Then YesMatch = False
If txtSCity <> "" And txtSCity <> City Then YesMatch = False
If txtSState <> "" And txtSState <> State Then YesMatch = False
If txtSZip <> "" And txtSZip <> Zip Then YesMatch = False
If txtSPhone <> "" And txtSPhone <> Phone Then YesMatch = False
If txtSDate <> "" And txtSDate <> Sold Then YesMatch = False
Rem * do we have a match? if so, add it to MS Flex Grid display
If YesMatch And TotalMatches < 500 Then
DetailString = Track + tb + First + tb + Middle + tb + Last + tb + Addr1 + tb +
Addr2 + tb + City + tb + State + tb + Zip + tb + Phone + tb + Sold
grdSearch.AddItem (DetailString)
Rem * add current match to the Found array
TotalMatches = TotalMatches + 1
' FoundIndex(TotalMatches) = BMWSales.Recordset.AbsolutePosition
End If
Rem * move forward one record
BMWSales.Recordset.MoveNext
Next i
If TotalMatches = 0 Then MsgBox ("Sorry no matches found for these criteria, click OK")
End Sub
Rem ****************************************
Rem *
Rem * Code for SSearch (short search) form
Rem *
Rem * by Philip J. Porvaznik
Rem *
Rem ****************************************
Dim FoundIndex(100) As Integer ' allow for 100 matches found
Dim TotalMatches As Integer ' total number of matches
Private Sub cmdClear_Click()
Rem ********************************
Rem *
Rem * Clear the form for new search
Rem *
Rem ********************************
txtSTrack = ""
txtSModel = ""
txtSStock = ""
txtSOrder = ""
txtSSold = ""
txtSTrack.SetFocus
With grdSearch
.Clear
.Rows = 1
End With
End Sub
Private Sub cmdDone_Click()
Rem ********************************
Rem *
Rem * Done with search
Rem *
Rem * Close SSearch form
Rem * Return to BMW Inventory form
Rem *
Rem ********************************
frmSSearch.Visible = False
frmBMWInventory.Visible = True
End Sub
Private Sub cmdSearch_Click()
Rem *****************************************
Rem *
Rem * Search sequentially through the
Rem * BMW Inventory for Track Code or Model
Rem * using the Stock, Order, Sold criteria
Rem *
Rem *****************************************
Dim i As Integer, YesMatch As Boolean, tb As String, DetailString As String
Dim Track As String, Model As String, Stock As String, Order As String, Sold As String
tb = vbTab ' set up tab key for display
With grdSearch ' set up MS Flex Grid for headings
.Clear
.TextMatrix(0, 0) = "Track"
.TextMatrix(0, 1) = "Model"
.TextMatrix(0, 2) = "Stock"
.TextMatrix(0, 3) = "Order"
.TextMatrix(0, 4) = "Sold"
.Rows = 1
End With
TotalMatches = 0 ' set total number of matches to zero
BMWInventory.Recordset.MoveFirst ' go to the first record in Inventory database
For i = 1 To BMWInventory.Recordset.RecordCount ' search sequentially thru Inventory
Track = BMWInventory.Recordset.Fields("TrackCode")
Model = BMWInventory.Recordset.Fields("ModelNumber")
Stock = BMWInventory.Recordset.Fields("NumInStock")
Order = BMWInventory.Recordset.Fields("NumOnOrder")
Sold = BMWInventory.Recordset.Fields("NumSold")
YesMatch = True ' set match test state to True
Rem * check all fields for match, ignore if left blank
If txtSTrack <> "" And txtSTrack <> Track Then YesMatch = False
If txtSModel <> "" And txtSModel <> Model Then YesMatch = False
If txtSStock <> "" And Val(txtSStock) > Val(Stock) Then YesMatch = False
If txtSOrder <> "" And Val(txtSOrder) > Val(Order) Then YesMatch = False
If txtSSold <> "" And Val(txtSSold) > Val(Sold) Then YesMatch = False
Rem * do we have a match? if so, add it to MS Flex Grid display
If YesMatch And TotalMatches < 100 Then
DetailString = Track + tb + Model + tb + Stock + tb + Order + tb + Sold
grdSearch.AddItem (DetailString)
Rem * add current match to the Found array
TotalMatches = TotalMatches + 1
' FoundIndex(TotalMatches) = BMWInventory.Recordset.AbsolutePosition
End If
Rem * move forward one record
BMWInventory.Recordset.MoveNext
Next i
If TotalMatches = 0 Then MsgBox ("Sorry no matches found for these criteria, click OK")
End Sub
END OF CODE
APPENDIX: Term Project Assignment
CEN 4020-001 Ref. No. 13933 SOFTWARE ENGINEERING Term Project, Spring 2001
You are hired by a BMW dealership as a software engineer to develop a system to keep track of orders and the inventory of the 3-, 5- and 7-series of BMW sedans. In this term project you will design and develop a small version of such a system, called the BMW Sedan Tracking System, or BSTS for short. Although this project is a design project, with most of the details intentionally left open, there are certain components and features the system must contain. For each car, the following data must be supplied:Due: April 19, 2001
At the functional level, the following capabilities must be included:
No system can exist without a reasonably friendly interface. As a minimum, you must provide a text interface with a hierarchy of menus. Graphical interface is optional. However, keep in mind that
THE EMPHASIS MUST BE ON THE QUALITY OF THE DESIGN AND ON THE USEFULNESS OF THE SYSTEM, AND NOT ON THE NUMBER OF BELLS AND WHISTLES IT CONTAINS.
The entire project is subdivided into the following components:
These parts are chronological components of high quality software design.
YOUR DOCUMENT MUST CONTAIN A (DETAILED) DESCRIPTION OF EACH PART.
The individual components are outlined below.
On the project due date, you are expected to present the following:
