home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Database Creation Program"
- ClientHeight = 5775
- ClientLeft = 1350
- ClientTop = 960
- ClientWidth = 6720
- Height = 6240
- Left = 1260
- LinkTopic = "Form1"
- ScaleHeight = 5775
- ScaleWidth = 6720
- Top = 585
- Width = 6900
- Begin VB.CommandButton Command14
- Caption = "Create Salesmen Data"
- Height = 375
- Left = 2280
- TabIndex = 22
- Top = 3960
- Width = 2175
- End
- Begin VB.CommandButton Command13
- Caption = "Create Retail Items Index"
- Height = 375
- Left = 3960
- TabIndex = 20
- Top = 3000
- Width = 2535
- End
- Begin VB.CommandButton Command12
- Caption = "Create Customer Index"
- Height = 375
- Left = 240
- TabIndex = 19
- Top = 3000
- Width = 2295
- End
- Begin VB.CommandButton Command11
- Caption = "Create Order and Sales Data"
- Height = 375
- Left = 3720
- TabIndex = 15
- Top = 4560
- Width = 2775
- End
- Begin VB.CommandButton Command10
- Caption = "Add Retail Items"
- Height = 375
- Left = 4680
- TabIndex = 14
- Top = 3960
- Width = 1815
- End
- Begin VB.CommandButton Command9
- Caption = "Add SalesID to Customer"
- Height = 375
- Left = 240
- TabIndex = 13
- Top = 4560
- Width = 2415
- End
- Begin VB.PictureBox Picture1
- BackColor = &H00FF0000&
- Height = 495
- Left = 1680
- ScaleHeight = 465
- ScaleWidth = 3105
- TabIndex = 10
- Top = 5280
- Visible = 0 'False
- Width = 3135
- Begin VB.TextBox Text2
- Height = 285
- Left = 1560
- TabIndex = 12
- Text = "Text2"
- Top = 120
- Width = 1335
- End
- Begin VB.Label Label2
- BackColor = &H00FFFFFF&
- Caption = "Processing Record"
- Height = 255
- Left = 120
- TabIndex = 11
- Top = 120
- Width = 1455
- End
- End
- Begin VB.CommandButton Command8
- Caption = "Create Customer Data"
- Height = 375
- Left = 240
- TabIndex = 9
- Top = 3960
- Width = 1815
- End
- Begin VB.CommandButton Command7
- Caption = "Create remaining tables"
- Height = 375
- Left = 4320
- TabIndex = 8
- Top = 2160
- Width = 2175
- End
- Begin VB.CommandButton Command6
- Caption = "Create Orders Table"
- Height = 375
- Left = 240
- TabIndex = 7
- Top = 2160
- Width = 2175
- End
- Begin VB.CommandButton Command5
- Caption = "Create Retail Items Table"
- Height = 375
- Left = 4440
- TabIndex = 6
- Top = 1680
- Width = 2055
- End
- Begin VB.CommandButton Command4
- Caption = "Create Customers Table"
- Height = 375
- Left = 2280
- TabIndex = 5
- Top = 1680
- Width = 1935
- End
- Begin VB.CommandButton Command3
- Caption = "Create Salesmen Table"
- Height = 375
- Left = 240
- TabIndex = 4
- Top = 1680
- Width = 1815
- End
- Begin VB.TextBox Text1
- Height = 285
- Left = 2400
- TabIndex = 2
- Text = "Text1"
- Top = 120
- Width = 3855
- End
- Begin VB.CommandButton Command2
- Caption = "New File Name"
- Height = 375
- Left = 240
- TabIndex = 1
- Top = 840
- Width = 2175
- End
- Begin VB.CommandButton Command1
- Caption = "Create Database"
- Height = 375
- Left = 4200
- TabIndex = 0
- Top = 840
- Width = 2175
- End
- Begin VB.Line Line9
- X1 = 240
- X2 = 6480
- Y1 = 5160
- Y2 = 5160
- End
- Begin VB.Line Line8
- X1 = 3960
- X2 = 6480
- Y1 = 3720
- Y2 = 3720
- End
- Begin VB.Line Line7
- X1 = 240
- X2 = 2520
- Y1 = 3720
- Y2 = 3720
- End
- Begin VB.Label Label6
- Caption = "Load Test Data"
- Height = 255
- Left = 2640
- TabIndex = 21
- Top = 3600
- Width = 1215
- End
- Begin VB.Line Line6
- X1 = 3960
- X2 = 6480
- Y1 = 2760
- Y2 = 2760
- End
- Begin VB.Line Line5
- X1 = 240
- X2 = 2640
- Y1 = 2760
- Y2 = 2760
- End
- Begin VB.Label Label5
- Caption = "Index Creation"
- Height = 255
- Left = 2760
- TabIndex = 18
- Top = 2640
- Width = 1095
- End
- Begin VB.Line Line4
- X1 = 3960
- X2 = 6480
- Y1 = 1440
- Y2 = 1440
- End
- Begin VB.Line Line3
- X1 = 240
- X2 = 2640
- Y1 = 1440
- Y2 = 1440
- End
- Begin VB.Label Label4
- Caption = "Table Creation"
- Height = 255
- Left = 2760
- TabIndex = 17
- Top = 1320
- Width = 1095
- End
- Begin VB.Line Line2
- X1 = 4080
- X2 = 6480
- Y1 = 600
- Y2 = 600
- End
- Begin VB.Line Line1
- X1 = 240
- X2 = 2400
- Y1 = 600
- Y2 = 600
- End
- Begin VB.Label Label3
- Caption = "Database Creation"
- Height = 255
- Left = 2520
- TabIndex = 16
- Top = 480
- Width = 1455
- End
- Begin VB.Label Label1
- Caption = "Current Database File Name:"
- Height = 255
- Left = 240
- TabIndex = 3
- Top = 120
- Width = 2175
- End
- Begin MSComDlg.CommonDialog GetFile
- Left = 6240
- Top = 0
- _version = 65536
- _extentx = 847
- _extenty = 847
- _stockprops = 0
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Dim OldDb As DATABASE, OldWs As Workspace, DataName As String
- Private Sub Command1_Click()
- If Len(Dir(DataName)) > 0 Then
- MsgBox "File already exists", 0
- Else
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.CreateDatabase(DataName, dbLangGeneral)
- MsgBox "Database file " & DataName & " created.", 0
- OldDb.Close
- End If
- End Sub
- Private Sub Command10_Click()
- 'This routine reads in "Retail Item" data from an existing text file.
- Dim OldDb As DATABASE, OldTbl As Recordset, OldWs As Workspace
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- Set OldTbl = OldDb.OpenRecordset("Retail Items", dbOpenTable)
- Open App.Path & "\RETAIL.TXT" For Input As #1
- Do While Not EOF(1)
- Input #1, itm, DESC$, price, rtprice
- OldTbl.AddNew
- OldTbl("Item Code") = itm
- OldTbl("Item Description") = DESC$
- OldTbl("Wholesale") = price
- OldTbl("Retail") = rtprice
- OldTbl.UPDATE
- Loop
- Close #1
- OldTbl.Close
- OldDb.Close
- MsgBox "Retail Items added", 0
- End Sub
- Private Sub Command11_Click()
- 'This routine creates sales order information for a 30 day period.
- Dim OldDb As DATABASE, OldTbl As Recordset, Tabl2 As Recordset
- Dim Tabl3 As Recordset, Tabl4 As Recordset, OldWs As Workspace
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- Set OldTbl = OldDb.OpenRecordset("Customers", dbOpenTable)
- Set Tabl2 = OldDb.OpenRecordset("Orders", dbOpenTable)
- Set Tabl3 = OldDb.OpenRecordset("Sales", dbOpenTable)
- Set Tabl4 = OldDb.OpenRecordset("Retail Items", dbOpenTable)
- OldTbl.Index = "Custno"
- Tabl4.Index = "Items"
- ordate = Date - 16
- ordnm = 1
- Picture1.Visible = True
- Label2.Caption = "Processing Order"
- For I = 1 To 30
- nmcalls = Int(Rnd * 20 + 70)
- OldWs.BeginTrans
- For J = 1 To nmcalls
- K = Int(Rnd * 1600) + 1
- OldTbl.Seek "=", K
- If Not OldTbl.NoMatch Then
- salesmn = OldTbl("SalesID")
- totsls = 0#
- L = Int(Rnd * 5) + 1
- For M = 1 To L
- itm = Int(Rnd * 100) + 1000
- iqty = Int(Rnd * 5) + 1
- Tabl3.AddNew
- Tabl3("Orderno") = ordnm
- Tabl3("Item Code") = itm
- Tabl3("Quantity") = iqty
- Tabl3.UPDATE
- Tabl4.Seek "=", itm
- If Not Tabl4.NoMatch Then
- price = Tabl4("Retail")
- Else
- price = 0#
- End If
- totsls = totsls + ordnm * price
- Next M
- Tabl2.AddNew
- Tabl2("Custno") = K
- Tabl2("SalesID") = salesmn
- Tabl2("OrderDate") = ordate
- Tabl2("Orderno") = ordnm
- Tabl2("Totcost") = totsls
- Tabl2.UPDATE
- End If
- ordnm = ordnm + 1
- Next J
- OldWs.CommitTrans
- Text2.TEXT = ordnm
- DoEvents
- ordate = ordate + 1
- Next I
- Picture1.Visible = False
- OldTbl.Close
- Tabl2.Close
- Tabl3.Close
- Tabl4.Close
- OldDb.Close
- MsgBox Str(ordnm) + " orders processed", 0
- End Sub
- Private Sub Command12_Click()
- 'This routine sets up the customer number index
- Dim NewTbl As TableDef, Idx1 As Index, Fld1 As Field
- 'Set up workspace and database
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- 'Create tabledef object
- Set NewTbl = OldDb.TableDefs("Customers")
- Set Idx1 = NewTbl.CREATEINDEX("Custno")
- Idx1.PRIMARY = True
- Set Fld1 = Idx1.CreateField("Custno")
- Idx1.Fields.Append Fld1
- NewTbl.Indexes.Append Idx1
- OldDb.Close
- MsgBox "Customer index created", 0
- End Sub
- Private Sub Command13_Click()
- 'This routine sets up the item code index
- Dim NewTbl As TableDef, Idx1 As Index, Fld1 As Field
- 'Set up workspace and database
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- 'Create tabledef object
- Set NewTbl = OldDb.TableDefs("Retail Items")
- Set Idx1 = NewTbl.CREATEINDEX("Items")
- Idx1.PRIMARY = True
- Set Fld1 = Idx1.CreateField("Item Code")
- Idx1.Fields.Append Fld1
- NewTbl.Indexes.Append Idx1
- OldDb.Close
- MsgBox "Item Code index created", 0
- End Sub
- Private Sub Command14_Click()
- Dim OldDb As DATABASE, OldTbl As Recordset, OldWs As Workspace
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- Set OldTbl = OldDb.OpenRecordset("Salesmen", dbOpenTable)
- OldTbl.AddNew
- OldTbl("SalesLast") = "Moore"
- OldTbl("SalesFirst") = "Alex"
- OldTbl("SalesID") = "AMOORE"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Dannon"
- OldTbl("SalesFirst") = "Beth"
- OldTbl("SalesID") = "BDANNO"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Walsh"
- OldTbl("SalesFirst") = "Bill"
- OldTbl("SalesID") = "BWALSH"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Fields"
- OldTbl("SalesFirst") = "Carol"
- OldTbl("SalesID") = "CFIELD"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Green"
- OldTbl("SalesFirst") = "Elizabeth"
- OldTbl("SalesID") = "EGREEN"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Burns"
- OldTbl("SalesFirst") = "John"
- OldTbl("SalesID") = "JBURNS"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Thomas"
- OldTbl("SalesFirst") = "Jim"
- OldTbl("SalesID") = "JTHOMA"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Miller"
- OldTbl("SalesFirst") = "Karen"
- OldTbl("SalesID") = "KMILLE"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Evans"
- OldTbl("SalesFirst") = "Lisa"
- OldTbl("SalesID") = "LEVANS"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Adams"
- OldTbl("SalesFirst") = "Max"
- OldTbl("SalesID") = "MADAMS"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Johnson"
- OldTbl("SalesFirst") = "Mary"
- OldTbl("SalesID") = "MJOHNS"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Norton"
- OldTbl("SalesFirst") = "Mike"
- OldTbl("SalesID") = "MNORTO"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Smith"
- OldTbl("SalesFirst") = "Robyn"
- OldTbl("SalesID") = "RSMITH"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Reid"
- OldTbl("SalesFirst") = "Sam"
- OldTbl("SalesID") = "SREID"
- OldTbl.UPDATE
- OldTbl.AddNew
- OldTbl("SalesLast") = "Jackson"
- OldTbl("SalesFirst") = "Tim"
- OldTbl("SalesID") = "TJACKS"
- OldTbl.UPDATE
- OldTbl.Close
- OldDb.Close
- MsgBox "Salesmen data added", 0
- End Sub
- Private Sub Command2_Click()
- GetFile.Filter = "Database Files (*.MDB)|*.mdb|All Files|*.*"
- GetFile.DefaultExt = "MDB"
- GetFile.ShowOpen
- DataName = GetFile.filename
- Text1.TEXT = DataName
- End Sub
- Private Sub Command3_Click()
- ' This routine uses the old VB3 methods to create the Salesmen table
- Dim NewTbl As New TableDef, NewDb As DATABASE
- Set NewDb = OpenDatabase(DataName)
- NewTbl.Name = "Salesmen"
- Dim F1 As New Field, F2 As New Field, F3 As New Field
- F1.Name = "SalesID"
- F1.Type = dbText
- F1.Size = 6
- F2.Name = "SalesLast"
- F2.Type = dbText
- F2.Size = 30
- F3.Name = "SalesFirst"
- F3.Type = dbText
- F3.Size = 30
- NewTbl.Fields.Append F1
- NewTbl.Fields.Append F2
- NewTbl.Fields.Append F3
- NewDb.TableDefs.Append NewTbl
- MsgBox "Salesmen table was created", 0
- NewDb.Close
- End Sub
- Private Sub Command4_Click()
- 'This routine creates the Customers table using the CreateFields method
- ' with the optional arguments specified.
- 'Dimension data access objects
- Dim NewTbl As TableDef, F1 As Field, F2 As Field, F3 As Field, F4 As Field
- Dim F5 As Field, F6 As Field, F7 As Field, F8 As Field
- Dim F9 As Field, F10 As Field
- 'Set up workspace and database
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- 'Create tabledef object
- Set NewTbl = OldDb.CreateTableDef("Customers")
- 'Create field objects
- Set F1 = NewTbl.CreateField("Custno", dbLong)
- F1.Attributes = dbAutoIncrField
- Set F2 = NewTbl.CreateField("Lastname", dbText, 30)
- Set F3 = NewTbl.CreateField("Firstname", dbText, 30)
- Set F4 = NewTbl.CreateField("Address", dbText, 40)
- Set F5 = NewTbl.CreateField("City", dbText, 30)
- Set F6 = NewTbl.CreateField("State", dbText, 2)
- Set F7 = NewTbl.CreateField("Zip", dbText, 5)
- Set F8 = NewTbl.CreateField("Phone", dbText, 13)
- Set F9 = NewTbl.CreateField("Interests", dbMemo)
- Set F10 = NewTbl.CreateField("SalesID", dbText, 6)
- 'Add fields to tabledef
- NewTbl.Fields.Append F1
- NewTbl.Fields.Append F2
- NewTbl.Fields.Append F3
- NewTbl.Fields.Append F4
- NewTbl.Fields.Append F5
- NewTbl.Fields.Append F6
- NewTbl.Fields.Append F7
- NewTbl.Fields.Append F8
- NewTbl.Fields.Append F9
- NewTbl.Fields.Append F10
- 'Add tabledef to database
- OldDb.TableDefs.Append NewTbl
- OldDb.Close
- MsgBox "Customers table created", 0
- End Sub
- Private Sub Command5_Click()
- 'This routine creates the Retail Items table using the CreateFields method
- ' without the optional arguments specified. All field properties are
- ' explicitly set.
- 'Dimension data access objects
- Dim NewTbl As TableDef, Fld(1 To 9) As Field
- 'Set up workspace and database
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- 'Create tabledef object
- Set NewTbl = OldDb.CreateTableDef("Retail Items")
- NewTbl.ValidationRule = "[Retail] > [Wholesale]"
- NewTbl.ValidationText = "Retail price must exceed wholesale price."
- 'Create field objects
- For I = 1 To 9
- Set Fld(I) = NewTbl.CreateField()
- Next I
- Fld(1).Name = "Item Code"
- Fld(1).Type = dbInteger
- Fld(2).Name = "Item Description"
- Fld(2).Type = dbText
- Fld(2).Size = 50
- Fld(3).Name = "Product Category"
- Fld(3).Type = dbText
- Fld(3).Size = 10
- Fld(4).Name = "Wholesale"
- Fld(4).Type = dbSingle
- Fld(4).ValidationRule = "[Wholesale] > 0"
- Fld(4).ValidationText = "Wholesale price must be greater than 0."
- Fld(5).Name = "Retail"
- Fld(5).Type = dbSingle
- Fld(6).Name = "Min Quantity"
- Fld(6).Type = dbInteger
- Fld(7).Name = "OnHand"
- Fld(7).Type = dbInteger
- Fld(8).Name = "SupplierID"
- Fld(8).Type = dbLong
- Fld(9).Name = "Photo"
- Fld(9).Type = dbLongBinary
- 'Add fields to tabledef
- For I = 1 To 9
- NewTbl.Fields.Append Fld(I)
- Next I
- 'Add tabledef to database
- OldDb.TableDefs.Append NewTbl
- OldDb.Close
- MsgBox "Retail Items table created", 0
- End Sub
- Private Sub Command6_Click()
- 'This routine creates the Orders table using a DDL query.
- 'Set up workspace and database
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- SQLCreate = "CREATE TABLE Orders (Orderno INTEGER, Custno LONG, SalesID TEXT (6), OrderDate DATE, Totcost SINGLE)"
- OldDb.Execute SQLCreate
- OldDb.Close
- MsgBox "Orders table has been created.", 0
- End Sub
- Private Sub Command7_Click()
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- SQLCreate = "CREATE TABLE Sales (Orderno INTEGER, [Item Code] INTEGER, "
- SQLCreate = SQLCreate + "Quantity INTEGER)"
- OldDb.Execute SQLCreate
- SQLCreate = "CREATE TABLE Suppliers (SupplierID LONG, Name TEXT (50), "
- SQLCreate = SQLCreate + "Contact TEXT (50), Address TEXT (50), City "
- SQLCreate = SQLCreate + "TEXT (30), State TEXT (2), Zip TEXT (5), "
- SQLCreate = SQLCreate + "Phone TEXT (13))"
- OldDb.Execute SQLCreate
- OldDb.Close
- MsgBox "Other tables have been created.", 0
- End Sub
- Private Sub Command8_Click()
- 'This routine creates 1600 customer records for the Customers table.
- ReDim fname$(1 To 40), lname$(1 To 40), city2$(1 To 100)
- ReDim stateID$(1 To 100), stzip$(1 To 100), starea$(1 To 100)
- ReDim street$(1 To 40)
- Dim OldDb As DATABASE, OldTbl As Recordset
- fname$(1) = "Alice"
- fname$(2) = "Andrew"
- fname$(3) = "Betty"
- fname$(4) = "Bill"
- fname$(5) = "Charles"
- fname$(6) = "Debra"
- fname$(7) = "Don"
- fname$(8) = "Erin"
- fname$(9) = "Eric"
- fname$(10) = "Faye"
- fname$(11) = "Frank"
- fname$(12) = "Gail"
- fname$(13) = "Greg"
- fname$(14) = "Helen"
- fname$(15) = "Henry"
- fname$(16) = "Janice"
- fname$(17) = "John"
- fname$(18) = "Karen"
- fname$(19) = "Laura"
- fname$(20) = "Larry"
- fname$(21) = "Michele"
- fname$(22) = "Michael"
- fname$(23) = "Nancy"
- fname$(24) = "Nick"
- fname$(25) = "Paula"
- fname$(26) = "Pete"
- fname$(27) = "Rhonda"
- fname$(28) = "Richard"
- fname$(29) = "Sally"
- fname$(30) = "Sam"
- fname$(31) = "Scott"
- fname$(32) = "Terry"
- fname$(33) = "Thomas"
- fname$(34) = "Vicky"
- fname$(35) = "Wanda"
- fname$(36) = "Lisa"
- fname$(37) = "Elizabeth"
- fname$(38) = "Doug"
- fname$(39) = "Bruce"
- fname$(40) = "Pam"
- lname$(1) = "Andrews"
- lname$(2) = "Brown"
- lname$(3) = "Casey"
- lname$(4) = "Davis"
- lname$(5) = "Fleming"
- lname$(6) = "Gray"
- lname$(7) = "Hancock"
- lname$(8) = "James"
- lname$(9) = "Kirk"
- lname$(10) = "Lewis"
- lname$(11) = "Moore"
- lname$(12) = "Monroe"
- lname$(13) = "Nelson"
- lname$(14) = "O'Toole"
- lname$(15) = "Richards"
- lname$(16) = "Scott"
- lname$(17) = "Thompson"
- lname$(18) = "Vincent"
- lname$(19) = "Walters"
- lname$(20) = "Young"
- lname$(21) = "Adams"
- lname$(22) = "Black"
- lname$(23) = "Coleman"
- lname$(24) = "Douglas"
- lname$(25) = "Evans"
- lname$(26) = "Fontaine"
- lname$(27) = "Green"
- lname$(28) = "Hawthorne"
- lname$(29) = "Johnson"
- lname$(30) = "Long"
- lname$(31) = "Maxwell"
- lname$(32) = "Nichols"
- lname$(33) = "Owens"
- lname$(34) = "Roberts"
- lname$(35) = "Smith"
- lname$(36) = "Taylor"
- lname$(37) = "Vaughn"
- lname$(38) = "White"
- lname$(39) = "Polk"
- lname$(40) = "Jackson"
- street$(1) = "Main Street"
- street$(2) = "Government Street"
- street$(3) = "Brook Lane"
- street$(4) = "Meadow Drive"
- street$(5) = "Jefferson Road"
- street$(6) = "Montgomery Highway"
- street$(7) = "Happy Trail"
- street$(8) = "J Street"
- street$(9) = "1st Avenue"
- street$(10) = "Berkley Drive"
- street$(11) = "Bayou Boulevard"
- street$(12) = "Morris Avenue"
- street$(13) = "Old Mill Road"
- street$(14) = "Langley"
- street$(15) = "Valley Road"
- street$(16) = "Strawberry Lane"
- street$(17) = "Lexington Way"
- street$(18) = "Archer Road"
- street$(19) = "Panorama Trace"
- street$(20) = "Skyview Lane"
- street$(21) = "Water Oak Drive"
- street$(22) = "Burning Tree Road"
- street$(23) = "East Ridge Circle"
- street$(24) = "Hillcrest Drive"
- street$(25) = "Sherwood Forest"
- street$(26) = "Seaview Drive"
- street$(27) = "Crabb Lane"
- street$(28) = "Canterbury Trails"
- street$(29) = "Native Dancer Drive"
- street$(30) = "Beacon Hill Road"
- street$(31) = "River Bend"
- street$(32) = "Sandy Springs Road"
- street$(33) = "Lookout Drive"
- street$(34) = "Hurricane Way"
- street$(35) = "Shifting Sands Trail"
- street$(36) = "English Knoll"
- street$(37) = "Wilderness Trail"
- street$(38) = "Yorkshire Place"
- street$(39) = "Lost Your Way"
- street$(40) = "Hidden Valley Lane"
- city2$(1) = "Little Rock"
- stateID$(1) = "AR"
- stzip$(1) = "72203"
- starea$(1) = "501"
- city2$(2) = "Birmingham"
- stateID$(2) = "AL"
- stzip$(2) = "35203"
- starea$(2) = "205"
- city2$(3) = "Mobile"
- stateID$(3) = "AL"
- stzip$(3) = "36608"
- starea$(3) = "205"
- city2$(4) = "Juneau"
- stateID$(4) = "AK"
- stzip$(4) = "99802"
- starea$(4) = "907"
- city2$(5) = "Fairbanks"
- stateID$(5) = "AK"
- stzip$(5) = "99709"
- starea$(5) = "907"
- city2$(6) = "Phoenix"
- stateID$(6) = "AZ"
- stzip$(6) = "85021"
- starea$(6) = "602"
- city2$(7) = "Tuscon"
- stateID$(7) = "AZ"
- stzip$(7) = "85715"
- starea$(7) = "602"
- city2$(8) = "San Francisco"
- stateID$(8) = "CA"
- stzip$(8) = "94105"
- starea$(8) = "415"
- city2$(9) = "Los Angeles"
- stateID$(9) = "CA"
- stzip$(9) = "90036"
- starea$(9) = "213"
- city2$(10) = "Denver"
- stateID$(10) = "CO"
- stzip$(10) = "80226"
- starea$(10) = "303"
- city2$(11) = "Boulder"
- stateID$(11) = "CO"
- stzip$(11) = "80303"
- starea$(11) = "303"
- city2$(12) = "Wilmington"
- stateID$(12) = "DE"
- stzip$(12) = "72203"
- starea$(12) = "501"
- city2$(13) = "Orlando"
- stateID$(13) = "FL"
- stzip$(13) = "32804"
- starea$(13) = "407"
- city2$(14) = "Jacksonville"
- stateID$(14) = "FL"
- stzip$(14) = "32257"
- starea$(14) = "904"
- city2$(15) = "Miami"
- stateID$(15) = "FL"
- stzip$(15) = "33162"
- starea$(15) = "305"
- city2$(16) = "Atlanta"
- stateID$(16) = "GA"
- stzip$(16) = "30314"
- starea$(16) = "404"
- city2$(17) = "Augusta"
- stateID$(17) = "GA"
- stzip$(17) = "30904"
- starea$(17) = "706"
- city2$(18) = "Honolulu"
- stateID$(18) = "HI"
- stzip$(18) = "96817"
- starea$(18) = "808"
- city2$(19) = "Hilo"
- stateID$(19) = "HI"
- stzip$(19) = "96721"
- starea$(19) = "808"
- city2$(20) = "Boise"
- stateID$(20) = "ID"
- stzip$(20) = "83709"
- starea$(20) = "208"
- city2$(21) = "Hartford"
- stateID$(21) = "CT"
- stzip$(21) = "06117"
- starea$(21) = "203"
- city2$(22) = "Chicago"
- stateID$(22) = "IL"
- stzip$(22) = "60639"
- starea$(22) = "312"
- city2$(23) = "Peoria"
- stateID$(23) = "IL"
- stzip$(23) = "61605"
- starea$(23) = "309"
- city2$(24) = "Indianapolis"
- stateID$(24) = "IN"
- stzip$(24) = "46209"
- starea$(24) = "317"
- city2$(25) = "Fort Wayne"
- stateID$(25) = "IN"
- stzip$(25) = "46835"
- starea$(25) = "317"
- city2$(26) = "Des Moines"
- stateID$(26) = "IA"
- stzip$(26) = "50317"
- starea$(26) = "515"
- city2$(27) = "Cedar Rapids"
- stateID$(27) = "IA"
- stzip$(27) = "52402"
- starea$(27) = "515"
- city2$(28) = "Wichita"
- stateID$(28) = "KS"
- stzip$(28) = "67219"
- starea$(28) = "316"
- city2$(29) = "Topeka"
- stateID$(29) = "KS"
- stzip$(29) = "66614"
- starea$(29) = "913"
- city2$(30) = "Lexington"
- stateID$(30) = "KY"
- stzip$(30) = "40502"
- starea$(30) = "606"
- city2$(31) = "New Orleans"
- stateID$(31) = "LA"
- stzip$(31) = "70122"
- starea$(31) = "504"
- city2$(32) = "Shreveport"
- stateID$(32) = "LA"
- stzip$(32) = "71118"
- starea$(32) = "318"
- city2$(33) = "Portland"
- stateID$(33) = "ME"
- stzip$(33) = "04106"
- starea$(33) = "207"
- city2$(34) = "Bangor"
- stateID$(34) = "ME"
- stzip$(34) = "04401"
- starea$(34) = "207"
- city2$(35) = "Baltimore"
- stateID$(35) = "MD"
- stzip$(35) = "21204"
- starea$(35) = "410"
- city2$(36) = "Washington"
- stateID$(36) = "DC"
- stzip$(36) = "20215"
- starea$(36) = "202"
- city2$(37) = "Boston"
- stateID$(37) = "MA"
- stzip$(37) = "02166"
- starea$(37) = "617"
- city2$(38) = "Springfield"
- stateID$(38) = "MA"
- stzip$(38) = "01119"
- starea$(38) = "413"
- city2$(39) = "Detroit"
- stateID$(39) = "MI"
- stzip$(39) = "48214"
- starea$(39) = "313"
- city2$(40) = "Lansing"
- stateID$(40) = "MI"
- stzip$(40) = "48906"
- starea$(40) = "517"
- city2$(41) = "Minneapolis"
- stateID$(41) = "MN"
- stzip$(41) = "55446"
- starea$(41) = "612"
- city2$(42) = "St. Paul"
- stateID$(42) = "MN"
- stzip$(42) = "55109"
- starea$(42) = "612"
- city2$(43) = "Jackson"
- stateID$(43) = "MS"
- stzip$(43) = "39208"
- starea$(43) = "601"
- city2$(44) = "Gulfport"
- stateID$(44) = "MS"
- stzip$(44) = "39507"
- starea$(44) = "601"
- city2$(45) = "St. Louis"
- stateID$(45) = "MO"
- stzip$(45) = "63146"
- starea$(45) = "314"
- city2$(46) = "Kansas City"
- stateID$(46) = "MO"
- stzip$(46) = "64132"
- starea$(46) = "816"
- city2$(47) = "Billings"
- stateID$(47) = "MT"
- stzip$(47) = "59101"
- starea$(47) = "406"
- city2$(48) = "Omaha"
- stateID$(48) = "NE"
- stzip$(48) = "68154"
- starea$(48) = "402"
- city2$(49) = "Lincoln"
- stateID$(49) = "NE"
- stzip$(49) = "68502"
- starea$(49) = "402"
- city2$(50) = "Las Vegas"
- stateID$(50) = "NV"
- stzip$(50) = "89110"
- starea$(50) = "702"
- city2$(51) = "Reno"
- stateID$(51) = "NV"
- stzip$(51) = "89520"
- starea$(51) = "702"
- city2$(52) = "Portsmouth"
- stateID$(52) = "NH"
- stzip$(52) = "03801"
- starea$(52) = "603"
- city2$(53) = "Newark"
- stateID$(53) = "NJ"
- stzip$(53) = "07105"
- starea$(53) = "201"
- city2$(54) = "Trenton"
- stateID$(54) = "NJ"
- stzip$(54) = "08618"
- starea$(54) = "609"
- city2$(55) = "New York City"
- stateID$(55) = "NY"
- stzip$(55) = "10023"
- starea$(55) = "212"
- city2$(56) = "Rochester"
- stateID$(56) = "NY"
- stzip$(56) = "14608"
- starea$(56) = "716"
- city2$(57) = "Buffalo"
- stateID$(57) = "NY"
- stzip$(57) = "14201"
- starea$(57) = "716"
- city2$(58) = "Syracuse"
- stateID$(58) = "NY"
- stzip$(58) = "13210"
- starea$(58) = "315"
- city2$(59) = "Albuquerque"
- stateID$(59) = "NM"
- stzip$(59) = "87113"
- starea$(59) = "505"
- city2$(60) = "Santa Fe"
- stateID$(60) = "NM"
- stzip$(60) = "87505"
- starea$(60) = "505"
- city2$(61) = "Bismark"
- stateID$(61) = "ND"
- stzip$(61) = "58501"
- starea$(61) = "701"
- city2$(62) = "Charlotte"
- stateID$(62) = "NC"
- stzip$(62) = "28209"
- starea$(62) = "704"
- city2$(63) = "Raleigh"
- stateID$(63) = "NC"
- stzip$(63) = "27612"
- starea$(63) = "919"
- city2$(64) = "Cleveland"
- stateID$(64) = "OH"
- stzip$(64) = "44111"
- starea$(64) = "216"
- city2$(65) = "Cincinnati"
- stateID$(65) = "OH"
- stzip$(65) = "45255"
- starea$(65) = "513"
- city2$(66) = "Toledo"
- stateID$(66) = "OH"
- stzip$(66) = "43623"
- starea$(66) = "419"
- city2$(67) = "Oklahoma City"
- stateID$(67) = "OK"
- stzip$(67) = "73130"
- starea$(67) = "405"
- city2$(68) = "Tulsa"
- stateID$(68) = "OK"
- stzip$(68) = "74128"
- starea$(68) = "918"
- city2$(69) = "Portland"
- stateID$(69) = "OR"
- stzip$(69) = "97267"
- starea$(69) = "503"
- city2$(70) = "Pittsburgh"
- stateID$(70) = "PA"
- stzip$(70) = "15229"
- starea$(70) = "412"
- city2$(71) = "Philadelphia"
- stateID$(71) = "PA"
- stzip$(71) = "19139"
- starea$(71) = "215"
- city2$(72) = "Columbia"
- stateID$(72) = "SC"
- stzip$(72) = "29204"
- starea$(72) = "803"
- city2$(73) = "Charleston"
- stateID$(73) = "SC"
- stzip$(73) = "29407"
- starea$(73) = "803"
- city2$(74) = "Sioux Falls"
- stateID$(74) = "SD"
- stzip$(74) = "57106"
- starea$(74) = "605"
- city2$(75) = "Nashville"
- stateID$(75) = "TN"
- stzip$(75) = "37209"
- starea$(75) = "901"
- city2$(76) = "Knoxville"
- stateID$(76) = "TN"
- stzip$(76) = "37917"
- starea$(76) = "615"
- city2$(77) = "Chattanooga"
- stateID$(77) = "TN"
- stzip$(77) = "37411"
- starea$(77) = "615"
- city2$(78) = "Dallas"
- stateID$(78) = "TX"
- stzip$(78) = "75229"
- starea$(78) = "214"
- city2$(79) = "Houston"
- stateID$(79) = "TX"
- stzip$(79) = "77026"
- starea$(79) = "713"
- city2$(80) = "Austin"
- stateID$(80) = "TX"
- stzip$(80) = "78748"
- starea$(80) = "512"
- city2$(81) = "Salt Lake City"
- stateID$(81) = "UT"
- stzip$(81) = "84121"
- starea$(81) = "801"
- city2$(82) = "Provo"
- stateID$(82) = "UT"
- stzip$(82) = "84604"
- starea$(82) = "801"
- city2$(83) = "Richmond"
- stateID$(83) = "VA"
- stzip$(83) = "23236"
- starea$(83) = "804"
- city2$(84) = "Williamsburg"
- stateID$(84) = "VA"
- stzip$(84) = "23185"
- starea$(84) = "804"
- city2$(85) = "Wheeling"
- stateID$(85) = "WV"
- stzip$(85) = "26003"
- starea$(85) = "304"
- city2$(86) = "Seattle"
- stateID$(86) = "WA"
- stzip$(86) = "98103"
- starea$(86) = "206"
- city2$(87) = "Spokane"
- stateID$(87) = "WA"
- stzip$(87) = "99204"
- starea$(87) = "509"
- city2$(88) = "Milwaukee"
- stateID$(88) = "WI"
- stzip$(88) = "53216"
- starea$(88) = "414"
- city2$(89) = "Green Bay"
- stateID$(89) = "WI"
- stzip$(89) = "54313"
- starea$(89) = "414"
- city2$(90) = "Cheyenne"
- stateID$(90) = "WY"
- stzip$(90) = "82009"
- starea$(90) = "307"
- city2$(91) = "Casper"
- stateID$(91) = "WY"
- stzip$(91) = "82601"
- starea$(91) = "307"
- city2$(92) = "Tampa"
- stateID$(92) = "FL"
- stzip$(92) = "33629"
- starea$(92) = "813"
- city2$(93) = "Huntsville"
- stateID$(93) = "AL"
- stzip$(93) = "35802"
- starea$(93) = "205"
- city2$(94) = "Savannah"
- stateID$(94) = "GA"
- stzip$(94) = "31406"
- starea$(94) = "912"
- city2$(95) = "San Antonio"
- stateID$(95) = "TX"
- stzip$(95) = "78223"
- starea$(95) = "512"
- city2$(96) = "San Diego"
- stateID$(96) = "CA"
- stzip$(96) = "92103"
- starea$(96) = "619"
- city2$(97) = "Sacramento"
- stateID$(97) = "CA"
- stzip$(97) = "95842"
- starea$(97) = "916"
- city2$(98) = "Pensacola"
- stateID$(98) = "FL"
- stzip$(98) = "32503"
- starea$(98) = "904"
- city2$(99) = "Baton Rouge"
- stateID$(99) = "LA"
- stzip$(99) = "70814"
- starea$(99) = "504"
- city2$(100) = "Burlington"
- stateID$(100) = "VT"
- stzip$(100) = "05401"
- starea$(100) = "802"
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- Set OldTbl = OldDb.OpenRecordset("Customers", dbOpenTable)
- Picture1.Visible = True
- For I = 1 To 40
- OldWs.BeginTrans
- For J = 1 To 40
- K2 = (I - 1) * 40 + J
- Text2.TEXT = Str(K2) & "of 1600"
- K = (K2 Mod 100) + 1
- L = 1 + Int(40 * Rnd())
- M = 1 + Int(9999 * Rnd())
- N = 1000 + Int(8999 * Rnd())
- OldTbl.AddNew
- OldTbl("Lastname") = lname$(I)
- OldTbl("Firstname") = fname$(J)
- OldTbl("City") = city2$(K)
- OldTbl("State") = stateID$(K)
- OldTbl("Zip") = stzip$(K)
- OldTbl("Address") = Str(M) & " " & street$(L)
- OldTbl("Phone") = "(" & starea$(K) & ")555-" & Right(Str(N), 4)
- OldTbl.UPDATE
- Next J
- OldWs.CommitTrans
- DoEvents
- Next I
- Picture1.Visible = False
- MsgBox "All data loaded", 0
- OldTbl.Close
- OldDb.Close
- End Sub
- Private Sub Command9_Click()
- ReDim sales$(1 To 15)
- Dim OldDb As DATABASE, OldTbl As Recordset, OldWs As Workspace
- Set OldWs = DBEngine.Workspaces(0)
- Set OldDb = OldWs.OpenDatabase(DataName)
- Set OldTbl = OldDb.OpenRecordset("Salesmen", dbOpenTable)
- OldTbl.MoveFirst
- For I = 1 To 15
- sales$(I) = OldTbl("SalesID")
- OldTbl.MoveNext
- Next I
- OldTbl.Close
- Set OldTbl = OldDb.OpenRecordset("Customers", dbOpenTable)
- OldTbl.MoveFirst
- J = 1
- Do Until OldTbl.EOF
- J = J + 1
- If J > 15 Then
- J = 1
- End If
- OldTbl.Edit
- OldTbl("SalesID") = sales$(J)
- OldTbl.UPDATE
- OldTbl.MoveNext
- Loop
- OldTbl.Close
- OldDb.Close
- MsgBox "Sales IDs added", 0
- End Sub
- Private Sub Form_Activate()
- GetFile.Filter = "Database Files (*.MDB)|*.mdb|All Files|*.*"
- GetFile.DefaultExt = "MDB"
- GetFile.ShowOpen
- DataName = GetFile.filename
- Text1.TEXT = DataName
- End Sub
-