home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form names
- BackColor = &H00808080&
- BorderStyle = 1 'Fixed Single
- Caption = "Customer Address"
- ClientHeight = 5280
- ClientLeft = 615
- ClientTop = 1605
- ClientWidth = 8295
- ForeColor = &H00808080&
- Height = 5970
- Left = 555
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- ScaleHeight = 5280
- ScaleMode = 0 'User
- ScaleWidth = 8400.607
- Top = 975
- Width = 8415
- Begin Frame Frame1
- BackColor = &H00C0C0C0&
- Caption = "Customer/Address/Record"
- ForeColor = &H00000000&
- Height = 4212
- Left = 120
- TabIndex = 11
- Top = 600
- Width = 8052
- Begin TextBox Text1
- Height = 372
- Index = 10
- Left = 1680
- TabIndex = 10
- Text = " "
- Top = 3480
- Width = 2172
- End
- Begin TextBox Text1
- Height = 372
- Index = 9
- Left = 5040
- TabIndex = 9
- Text = " "
- Top = 2880
- Width = 1572
- End
- Begin TextBox Text1
- Height = 372
- Index = 8
- Left = 4080
- TabIndex = 8
- Text = " "
- Top = 2880
- Width = 372
- End
- Begin TextBox Text1
- Height = 372
- Index = 7
- Left = 1680
- TabIndex = 7
- Text = " "
- Top = 2880
- Width = 1692
- End
- Begin TextBox Text1
- Height = 372
- Index = 6
- Left = 1680
- TabIndex = 6
- Text = " "
- Top = 2400
- Width = 4572
- End
- Begin TextBox Text1
- Height = 372
- Index = 5
- Left = 1680
- TabIndex = 5
- Text = " "
- Top = 1920
- Width = 4572
- End
- Begin TextBox Text1
- Height = 372
- Index = 4
- Left = 6600
- TabIndex = 4
- Text = " "
- Top = 1440
- Width = 372
- End
- Begin TextBox Text1
- Height = 372
- Index = 3
- Left = 3840
- TabIndex = 3
- Text = " "
- Top = 1440
- Width = 1692
- End
- Begin TextBox Text1
- Height = 372
- Index = 2
- Left = 1680
- TabIndex = 2
- Text = " "
- Top = 1440
- Width = 1332
- End
- Begin TextBox Text1
- Height = 372
- Index = 1
- Left = 1680
- TabIndex = 1
- Text = " "
- Top = 720
- Width = 612
- End
- Begin Label Label10
- BackColor = &H00C0C0C0&
- Caption = "Telephone"
- Height = 372
- Left = 600
- TabIndex = 13
- Top = 3480
- Width = 972
- End
- Begin Label Label9
- BackColor = &H00C0C0C0&
- Caption = "Zip"
- Height = 372
- Left = 4560
- TabIndex = 14
- Top = 2880
- Width = 372
- End
- Begin Label Label8
- BackColor = &H00C0C0C0&
- Caption = "State"
- Height = 372
- Left = 3480
- TabIndex = 0
- Top = 2880
- Width = 492
- End
- Begin Label Label7
- BackColor = &H00C0C0C0&
- Caption = "City"
- Height = 372
- Left = 600
- TabIndex = 17
- Top = 2880
- Width = 852
- End
- Begin Label Label5
- BackColor = &H00C0C0C0&
- Caption = "Address"
- Height = 372
- Left = 600
- TabIndex = 18
- Top = 2400
- Width = 852
- End
- Begin Label Label4
- BackColor = &H00C0C0C0&
- Caption = "Company"
- Height = 372
- Left = 600
- TabIndex = 12
- Top = 1920
- Width = 852
- End
- Begin Label Label2
- BackColor = &H00C0C0C0&
- Caption = "Initial"
- Height = 372
- Left = 6000
- TabIndex = 15
- Top = 1440
- Width = 492
- End
- Begin Label Label3
- BackColor = &H00C0C0C0&
- Caption = "Last name"
- Height = 372
- Left = 3240
- TabIndex = 16
- Top = 1440
- Width = 492
- End
- Begin Label Label1
- BackColor = &H00C0C0C0&
- Caption = "First Name"
- ForeColor = &H00000000&
- Height = 372
- Left = 600
- TabIndex = 19
- Top = 1440
- Width = 852
- End
- Begin Label Label6
- BackColor = &H00C0C0C0&
- Caption = "Id Number"
- ForeColor = &H00000000&
- Height = 372
- Left = 600
- TabIndex = 20
- Top = 720
- Width = 852
- End
- End
- Begin PictureBox Picture1
- AutoSize = -1 'True
- BackColor = &H00C0C0C0&
- BorderStyle = 0 'None
- ForeColor = &H00C0C0C0&
- Height = 480
- Index = 3
- Left = 3840
- Picture = FORM1.FRX:0000
- ScaleHeight = 480
- ScaleWidth = 480
- TabIndex = 23
- Top = 120
- Width = 480
- End
- Begin PictureBox NextRec
- AutoSize = -1 'True
- BackColor = &H00FFFFFF&
- BorderStyle = 0 'None
- Height = 480
- Index = 2
- Left = 2040
- Picture = FORM1.FRX:0302
- ScaleHeight = 480
- ScaleWidth = 480
- TabIndex = 22
- Top = 120
- Width = 480
- End
- Begin PictureBox Previous
- AutoSize = -1 'True
- BackColor = &H00FFFFFF&
- BorderStyle = 0 'None
- Height = 480
- Index = 1
- Left = 720
- Picture = FORM1.FRX:0604
- ScaleHeight = 480
- ScaleWidth = 480
- TabIndex = 21
- Top = 120
- Width = 480
- End
- Begin Menu AddRecord
- Caption = "Add"
- End
- Begin Menu UpdateRecord
- Caption = "Update"
- End
- Begin Menu DeleteRecord
- Caption = "Delete"
- End
- Begin Menu QueryClearTextBoxes
- Caption = "Query"
- End
- Begin Menu SearchRecord
- Caption = "Search"
- End
- Begin Menu FirstRecord
- Caption = "First"
- End
- Begin Menu LastRecord
- Caption = "Last"
- End
- Begin Menu NextRecord
- Caption = "Next"
- End
- Begin Menu PreviousRecord
- Caption = "Previous"
- End
- Begin Menu ListRecords
- Caption = "List"
- End
- Sub AddRecord_Click ()
- Call LoadDataBuf
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(binsert, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call ClearFormText
- End Sub
- Function bcreate (filename$)
- FileBuf.RecLen = Len(DataBuf)
- FileBuf.PageSize = 1024
- FileBuf.IndxCnt = 7
- FileBuf.FileFlags = 0
- Rem ACCOUNT NUMBER
- FileBuf.KeyPosition0 = 1
- FileBuf.KeyLength0 = 10
- FileBuf.KeyFlags0 = exttype% + modifiable%
- FileBuf.KeyType0 = bstring%
- Rem LAST NAME
- FileBuf.KeyPosition1 = 31
- FileBuf.KeyLength1 = 20
- FileBuf.KeyFlags1 = exttype% + modifiable% + dup%
- FileBuf.KeyType1 = bstring%
- Rem Company Name
- FileBuf.KeyPosition2 = 52
- FileBuf.KeyLength2 = 30
- FileBuf.KeyFlags2 = exttype% + modifiable% + dup%
- FileBuf.KeyType2 = bstring%
- Rem Company City
- FileBuf.KeyPosition3 = 112
- FileBuf.KeyLength3 = 20
- FileBuf.KeyFlags3 = exttype% + modifiable% + dup%
- FileBuf.KeyType3 = bstring%
- Rem Company State
- FileBuf.KeyPosition4 = 132
- FileBuf.KeyLength4 = 2
- FileBuf.KeyFlags4 = exttype% + modifiable% + dup%
- FileBuf.KeyType4 = bstring%
- Rem Company Zip
- FileBuf.KeyPosition5 = 134
- FileBuf.KeyLength5 = 12
- FileBuf.KeyFlags5 = exttype% + modifiable% + dup%
- FileBuf.KeyType5 = bstring%
- Rem Company Telephone
- FileBuf.KeyPosition6 = 144
- FileBuf.KeyLength6 = 12
- FileBuf.KeyFlags6 = exttype% + modifiable% + dup%
- FileBuf.KeyType6 = bstring%
- BufLen% = Len(FileBuf)
- KeyBuf.filename = "names.btr"
- KeyBuflen = Len(KeyBuffer)
- BufLen% = Len(FileBuf)
- KeyNum = 0
- BtreiveError.BtreiveStatusError.Text = "Creating file" + Str$(KeyBuflen) + Str$(BufLen%)
- status% = btrcall(bcreatenew, PositionBlock, FileBuf, BufLen%, KeyBuf, KeyBuflen, KeyNum)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Unload names
- Load names
- End If
- End Function
- Sub ClearFormText ()
- For X = 1 To SubFields
- names.Text1(X).Text = ""
- Next X
- End Sub
- Sub ClearTextBoxes_Click ()
- Call ClearFormText
- End Sub
- Sub DeleteRecord_Click ()
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bdelete, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message("Btreive Status%=" + Str$(status%))
- Else
- Call Message("Record Removed")
- Exit Sub
- End If
- Call ClearFormText
- End Sub
- Sub FirstRecord_Click ()
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bfirst, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call LoadFormText
- End Sub
- Sub Form_Load ()
- init = "/p:4096 /m:38 /u:2"
- X = wbtrvinit(init)
- KeyBuf.filename = "names.btr"
- KeyBuflen = Len(KeyBuffer)
- BufLen% = Len(DataBuf)
- KeyNum = 0
- status% = btrcall(bopen, PositionBlock, DataBuff, BufLen%, KeyBuf, KeyBuflen, KeyNum)
- If status% <> 0 Then
- Call Message(Str$(status%))
- If status% = 12 Then
- status% = bcreate(null$)
- For X = 1 To 100000: Y! = Sin(X): Next X
- Call Message("Creating btrieve file")
- End If
- End If
- End Sub
- Sub Form_Unload (Cancel As Integer)
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bclose, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message("Btreive Close Status%" + Str$(status%))
- End If
- End Sub
- Sub LastRecord_Click ()
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(blast, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call LoadFormText
- End Sub
- Sub ListRecords_Click ()
- 'put your print routines here
- End Sub
- Sub LoadDataBuf ()
- DataBuf.CustomerIDNumber$ = names.Text1(1).Text
- DataBuf.FirstName = names.Text1(2).Text
- DataBuf.Lastname = names.Text1(3).Text
- DataBuf.initial = names.Text1(4).Text
- DataBuf.company = names.Text1(5).Text
- DataBuf.address = names.Text1(6).Text
- DataBuf.city = names.Text1(7).Text
- DataBuf.state = names.Text1(8).Text
- DataBuf.zip = names.Text1(9).Text
- DataBuf.telephone = names.Text1(10).Text
- End Sub
- Sub LoadFormText ()
- names.Text1(1).Text = DataBuf.CustomerIDNumber
- names.Text1(2).Text = DataBuf.FirstName
- names.Text1(3).Text = DataBuf.Lastname
- names.Text1(4).Text = DataBuf.initial
- names.Text1(5).Text = DataBuf.company
- names.Text1(6).Text = DataBuf.address
- names.Text1(7).Text = DataBuf.city
- names.Text1(8).Text = DataBuf.state
- names.Text1(9).Text = DataBuf.zip
- names.Text1(10).Text = DataBuf.telephone
- End Sub
- Sub Message (TextString$)
- BtreiveError.Show 0
- BtreiveError.BtreiveStatusError.Text = TextString$
- For X = 1 To 100000: Y! = Sin(X): Next X
- BtreiveError.Hide
- End Sub
- Sub NextRec_Click (Index As Integer)
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bgetnext, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call LoadFormText
- End Sub
- Sub NextRecord_Click ()
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bgetnext, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call LoadFormText
- End Sub
- Sub Picture1_Click (Index As Integer)
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bgetnext, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call LoadFormText
- End Sub
- Sub Previous_Click (Index As Integer)
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bprevious, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call LoadFormText
- End Sub
- Sub PreviousRecord_Click ()
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bprevious, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call LoadFormText
- End Sub
- Sub QueryClearTextBoxes_Click ()
- Call ClearFormText
- End Sub
- Sub SearchRecord_Click ()
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- KeyBuf.filename = RTrim$(LTrim$(names.Text1(5).Text))
- KeyNum% = 2
- status% = btrcall(bgetgreaterorequal, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- Call LoadFormText
- End Sub
- Sub UpdateRecord_Click ()
- Call LoadDataBuf
- BufLen% = Len(DataBuf)
- KeyBuflen% = Len(KeyBuf)
- status% = btrcall(bupdate, PositionBlock, DataBuf, BufLen%, KeyBuf, KeyBuflen%, KeyNum%)
- If status% <> 0 Then
- Call Message(Str$(status%))
- Exit Sub
- End If
- End Sub
-