MODIFIED SOURCE CODE FOR Addindex.frm
Made on Tuesday, Apr 8, 2003 at 9:43 AM
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
'WAS: Me.Caption = Me.Caption & " to " & frmTblStruct.txtTableName
Me.Caption = Me.Caption & LoadResString(S547_to) & frmTblStruct.txtTableName
For i = 0 To frmTblStruct.lstFields.ListCount - 1
lstFields.AddItem frmTblStruct.lstFields.List(i)
Next
Else
'WAS: Me.Caption = Me.Caption & " to " & StripConnect(gnodDBNode2.Text)
Me.Caption = Me.Caption & LoadResString(S547_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
'WAS: FORMCAPTION = "Add Index"
FORMCAPTION = LoadResString(S37_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
'WAS: BUTTON2 = "&Close"
BUTTON2 = LoadResString(S94_Close)
End Property
'This was: Const LABEL0 = "Name:"
Property Get LABEL0 As String
'WAS: LABEL0 = "Name:"
LABEL0 = LoadResString(S330_Name)
End Property
'This was: Const Label1 = "Indexed Fields:"
Property Get Label1 As String
'WAS: Label1 = "Indexed Fields:"
Label1 = LoadResString(S300_Indexed_Fields)
End Property
'This was: Const Label2 = "Available Fields:"
Property Get Label2 As String
'WAS: Label2 = "Available Fields:"
Label2 = LoadResString(S66_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.
'WAS: Me.Caption = "Add Index"
Me.Caption = LoadResString(S37_Add_Index)
'WAS: chkIgnoreNulls.Caption = "IgnoreNulls"
chkIgnoreNulls.Caption = LoadResString(S283_IgnoreNulls)
'WAS: chkPrimary.Caption = "Primary"
chkPrimary.Caption = LoadResString(S418_Primary)
'WAS: chkUnique.Caption = "Unique"
chkUnique.Caption = LoadResString(S556_Unique)
'WAS: cmdOK.Caption = "&OK"
cmdOK.Caption = LoadResString(S355_OK)
'WAS: cmdClose.Caption = "&Close"
cmdClose.Caption = LoadResString(S94_Close)
'WAS: lblLabels(2).Caption = "Available Fields: "
lblLabels(2).Caption = LoadResString(S67_Available_Fields)
'WAS: lblLabels(1).Caption = "Indexed Fields:"
lblLabels(1).Caption = LoadResString(S299_Indexed_Fields)
'WAS: lblLabels(0).Caption = "Name: "
lblLabels(0).Caption = LoadResString(S331_Name)
End Sub