ORIGINAL SOURCE CODE FOR Addindex.frm

Made on Tuesday, Apr 8, 2003 at 9:43 AM

http://www.resourcemining.com

Addindex.frm contained 16 resource strings and 2 non-user interface strings.

Option Explicit

'>>>>>>>>>>>>>>>>>>>>>>>>
'ResMe Converted To A Property: Const FORMCAPTION = "Add Index"
'ResMe Converted To A Property: Const BUTTON1 = "&OK"
'ResMe Converted To A Property: Const BUTTON2 = "&Close"
'ResMe Converted To A Property: Const LABEL0 = "Name:"
'ResMe Converted To A Property: Const Label1 = "Indexed Fields:"
'ResMe Converted To A Property: Const Label2 = "Available Fields:"
'>>>>>>>>>>>>>>>>>>>>>>>>


Private Sub lstFields_Click()
  Dim sTmp As String

  sTmp = txtFields.Text
  If Len(sTmp) = 0 Then
    txtFields.Text = sTmp & lstFields
  Else
    txtFields.Text = sTmp & ";" & lstFields
  End If
  txtFields.Refresh
End Sub

Private Sub txtFields_Change()
  cmdOK.Enabled = Len(txtIndexName.Text) > 0 And Len(txtFields.Text) > 0
End Sub

Private Sub txtFields_LostFocus()
  cmdOK.Enabled = Len(txtIndexName.Text) > 0 And Len(txtFields.Text) > 0
End Sub

Private Sub txtIndexName_LostFocus()
  cmdOK.Enabled = Len(txtIndexName.Text) > 0 And Len(txtFields.Text) > 0
End Sub

Private Sub cmdClose_Click()
  Unload Me
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyF1 And Shift = 0 Then
    DisplayTopic 2016118
  End If
End Sub

Private Sub Form_Load()
    'ResMe autogenerated line of code to call the initialization routine that was automatically generated.
    Call frmAddIndex_Auto_Init
  Dim tblTableDef As TableDef
  Dim fld As Field
  Dim i As Integer

  Me.Caption = FORMCAPTION
  cmdOK.Caption = BUTTON1
  cmdClose.Caption = BUTTON2
  lblLabels(0).Caption = LABEL0
  lblLabels(1).Caption = Label1
  lblLabels(2).Caption = Label2
  
  If gbAddTableFlag Then
    Me.Caption = Me.Caption & " to " & frmTblStruct.txtTableName
    For i = 0 To frmTblStruct.lstFields.ListCount - 1
      lstFields.AddItem frmTblStruct.lstFields.List(i)
    Next
  Else
    Me.Caption = Me.Caption & " to " & StripConnect(gnodDBNode2.Text)
    Set tblTableDef = gdbCurrentDB.TableDefs(StripConnect(gnodDBNode2.Text))
    ListItemNames tblTableDef.Fields, lstFields, False
  End If
  If gsDataType <> gsMSACCESS Then
    chkPrimary.Enabled = False
    chkIgnoreNulls.Enabled = False
    chkPrimary.Value = vbGrayed
    chkIgnoreNulls.Value = vbGrayed
  End If
  SetDefaults
  
End Sub

Private Sub txtIndexName_Change()
  cmdOK.Enabled = Len(txtIndexName.Text) > 0 And Len(txtFields.Text) > 0
End Sub

Private Sub cmdOK_Click()
  Dim indIndexObj As Index
  Dim tblTableDefObj As TableDef
  Dim sTmp As String

  On Error GoTo AddIndexErr

  Screen.MousePointer = vbHourglass

  Set indIndexObj = gtdfTableDef.CreateIndex(txtIndexName.Text)
  With indIndexObj
    .Fields = txtFields.Text
    .Unique = chkUnique.Value
    If gsDataType = gsMSACCESS Then
      .Primary = IIf(chkPrimary.Value, True, False)
      .IgnoreNulls = IIf(chkIgnoreNulls.Value = vbChecked, True, False)
    End If
  End With

  'append the index to the global tabledef
  'from the tblstruct form
  gtdfTableDef.Indexes.Append indIndexObj
  'add the index to the list
  frmTblStruct.lstIndexes.AddItem txtIndexName.Text
  'make the new item active
  frmTblStruct.lstIndexes.ListIndex = frmTblStruct.lstIndexes.NewIndex
  
  'clear the name and allow entry of another
  SetDefaults
  txtIndexName.SetFocus
  
  Screen.MousePointer = vbDefault
  Exit Sub

AddIndexErr:
  ShowError
End Sub

Private Sub SetDefaults()
  txtIndexName.Text = vbNullString
  If gsDataType = gsMSACCESS Then
    txtFields.Text = vbNullString
    chkUnique.Value = vbChecked
  End If
End Sub


'*********************************************************************************
'**          This Section Of Code Was Automatically Generated By ResMe          **
'**                                                                             **
'** String assignments to Constants have been converted to read-only properties **
'*********************************************************************************


'This was: Const FORMCAPTION = "Add Index"
Property Get FORMCAPTION As String
    FORMCAPTION = "Add Index"
End Property

'This was: Const BUTTON1 = "&OK"
Property Get BUTTON1 As String
    BUTTON1 = "&OK"
End Property

'This was: Const BUTTON2 = "&Close"
Property Get BUTTON2 As String
    BUTTON2 = "&Close"
End Property

'This was: Const LABEL0 = "Name:"
Property Get LABEL0 As String
    LABEL0 = "Name:"
End Property

'This was: Const Label1 = "Indexed Fields:"
Property Get Label1 As String
    Label1 = "Indexed Fields:"
End Property

'This was: Const Label2 = "Available Fields:"
Property Get Label2 As String
    Label2 = "Available Fields:"
End Property


Private Sub frmAddIndex_Auto_Init()
'This routine initializes all User Interface control properties on frmAddIndex.
'This section of code was automatically generated by the ResMe String Extraction Utility.
    Me.Caption = "Add Index"
    chkIgnoreNulls.Caption = "IgnoreNulls"
    chkPrimary.Caption = "Primary"
    chkUnique.Caption = "Unique"
    cmdOK.Caption = "&OK"
    cmdClose.Caption = "&Close"
    lblLabels(2).Caption = "Available Fields: "
    lblLabels(1).Caption = "Indexed  Fields:"
    lblLabels(0).Caption = "Name: "
End Sub