home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / database / mf_db.zip / BCARDREF.FRM < prev    next >
Text File  |  1993-05-10  |  4KB  |  133 lines

  1. VERSION 2.00
  2. Begin Form bcardref 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Reference Table"
  6.    Height          =   3270
  7.    Left            =   1365
  8.    LinkTopic       =   "Form1"
  9.    MaxButton       =   0   'False
  10.    MinButton       =   0   'False
  11.    ScaleHeight     =   2895
  12.    ScaleWidth      =   4860
  13.    Top             =   2775
  14.    Width           =   4950
  15.    Begin CommandButton Command3 
  16.       Caption         =   "&Delete"
  17.       Height          =   435
  18.       Left            =   3840
  19.       TabIndex        =   3
  20.       Top             =   1080
  21.       Width           =   915
  22.    End
  23.    Begin CommandButton Command2 
  24.       Caption         =   "&New"
  25.       Height          =   435
  26.       Left            =   3840
  27.       TabIndex        =   2
  28.       Top             =   600
  29.       Width           =   915
  30.    End
  31.    Begin CommandButton Command1 
  32.       Caption         =   "&Edit"
  33.       Height          =   435
  34.       Left            =   3840
  35.       TabIndex        =   1
  36.       Top             =   120
  37.       Width           =   915
  38.    End
  39.    Begin ListBox List1 
  40.       FontBold        =   0   'False
  41.       FontItalic      =   0   'False
  42.       FontName        =   "Courier New"
  43.       FontSize        =   9.75
  44.       FontStrikethru  =   0   'False
  45.       FontUnderline   =   0   'False
  46.       Height          =   2430
  47.       Left            =   60
  48.       TabIndex        =   0
  49.       Top             =   120
  50.       Width           =   3675
  51.    End
  52. End
  53. Option Explicit
  54.  
  55. Sub Command1_Click ()
  56.     Dim s$, ref As tReference, lRecFound&, iCode%
  57.     'Which item is selected:
  58.     If list1.ListIndex = -1 Then
  59.         MsgBox "Select an item to edit"
  60.     Else
  61.         s = list1.List(list1.ListIndex)
  62.         
  63.         ' Now, we have the selected string:
  64.         ' PARSE it to get the 'seek key'
  65.         ref.ref = Val(Left$(s, 2))
  66.         ref.refsub = Val(Mid$(s, 3, 2))
  67.  
  68.         lRecFound = mfSeekO(ref, iCode, TaskHndl, refDBHndl, 0)
  69.             ' We SHOULD get an exact match
  70.         If iCode = MFSEEK_EXACT_MATCH Then
  71.             passl = lRecFound
  72.             bcardRED.Show ASMODAL
  73.             load_refs list1
  74.         Else
  75.             MsgBox "Wierd -- That record wasn't in the database?"
  76.         End If
  77.     End If
  78.  
  79.  
  80.  
  81. End Sub
  82.  
  83. Sub Command2_Click ()
  84.     Dim ref As tReference
  85.  
  86.     ' We HAVE to set a global variable to pass data
  87.     ' between forms
  88.     ref.name = ""
  89.     ref.ref = 0
  90.     ref.refsub = 1
  91.     passl = mfAppendData(ref.name, TaskHndl, refDBHndl)
  92.     junki = mfWrite(passl, ref, TaskHndl, refDBHndl, MFRW_ALL)
  93.     bcardRED.Show ASMODAL
  94.     load_refs list1
  95.  
  96. End Sub
  97.  
  98. ' Same basic code as an EDIT
  99. Sub Command3_Click ()
  100.     Dim s$, ref As tReference, lRecFound&, iCode%
  101.     'Which item is selected:
  102.     If list1.ListIndex = -1 Then
  103.         MsgBox "Select an item to edit"
  104.     Else
  105.         s = list1.List(list1.ListIndex)
  106.         
  107.         ' Now, we have the selected string:
  108.         ' PARSE it to get the 'seek key'
  109.         ref.ref = Val(Left$(s, 2))
  110.         ref.refsub = Val(Mid$(s, 3, 2))
  111.  
  112.         lRecFound = mfSeekO(ref, iCode, TaskHndl, refDBHndl, 0)
  113.             ' We SHOULD get an exact match
  114.         If iCode = MFSEEK_EXACT_MATCH Then
  115.             junki = mfDelete(lRecFound, TaskHndl, refDBHndl)
  116.             load_refs list1
  117.         Else
  118.             MsgBox "Wierd -- That record wasn't in the database?"
  119.         End If
  120.     End If
  121.  
  122.  
  123. End Sub
  124.  
  125. Sub Form_Load ()
  126.     Dim lCurRec As Long, ref As tReference
  127.     ' load list with data
  128.     ' (Located in bCards.bas)
  129.     load_refs list1
  130.  
  131. End Sub
  132.  
  133.