MODIFIED SOURCE CODE FOR REPLACE.FRM
Made on Tuesday, Apr 8, 2003 at 9:43 AM
Option Explicit
'>>>>>>>>>>>>>>>>>>>>>>>>
'ResMe Converted To A Property: Const FORMCAPTION = "Global Replace"
'ResMe Converted To A Property: Const BUTTON1 = "&OK"
'ResMe Converted To A Property: Const BUTTON2 = "&Cancel"
'ResMe Converted To A Property: Const Label1 = "&Table:"
'ResMe Converted To A Property: Const Label2 = "&Field:"
'ResMe Converted To A Property: Const LABEL3 = "&Replace With:"
'ResMe Converted To A Property: Const LABEL4 = "Cr&iteria:"
'ResMe Converted To A Property: Const MSG1 = "Replacing Records"
'>>>>>>>>>>>>>>>>>>>>>>>>
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub lstFields_Click()
cmdOK.Enabled = Len(lstFields.Text) > 0 And Len(txtReplaceWith.Text) > 0
End Sub
Private Sub txtReplaceWith_Change()
cmdOK.Enabled = Len(lstFields.Text) > 0 And Len(txtReplaceWith.Text) > 0
End Sub
Private Sub lstTables_Click()
Dim i As Integer
Dim fld As Field
ListItemNames gdbCurrentDB.TableDefs(StripConnect(lstTables.Text)).Fields, lstFields, True
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 And Shift = 0 Then
DisplayTopic 2016091
End If
End Sub
Private Sub Form_Load()
'ResMe autogenerated line of code to call the initialization routine that was automatically generated.
Call frmReplace_Auto_Init
Me.Caption = FORMCAPTION
cmdOK.Caption = BUTTON1
cmdCancel.Caption = BUTTON2
lblLabels(0).Caption = Label1
lblLabels(1).Caption = Label2
lblLabels(2).Caption = LABEL3
lblLabels(3).Caption = LABEL4
RefreshTables frmReplace.lstTables
End Sub
Private Sub cmdOK_Click()
Dim sReplaceTxt As String 'replace with string
Dim sWhereCondition As String 'where condition
On Error GoTo ReplaceErr
MsgBar MSG1, True
If gdbCurrentDB.TableDefs(StripConnect(lstTables.Text)).Fields(lstFields).Type = dbText Then
sReplaceTxt = "'" & txtReplaceWith & "'"
Else
sReplaceTxt = txtReplaceWith
End If
If Len(txtCondition.Text) = 0 Then
sWhereCondition = vbNullString
Else
'WAS: sWhereCondition = " where " & txtCondition
sWhereCondition = LoadResString(S589_where) & txtCondition
End If
If gsDataType = gsSQLDB Then
gdbCurrentDB.Execute "update " & StripConnect(lstTables.Text) & " set " & lstFields.Text & "=" & sReplaceTxt & sWhereCondition, dbSQLPassThrough
Else
gdbCurrentDB.Execute "update " & StripConnect(lstTables.Text) & " set [" & lstFields.Text & "]=" & sReplaceTxt & sWhereCondition
End If
If gdbCurrentDB.RecordsAffected > 0 Then
If gbTransPending Then gbDBChanged = True
End If
Unload Me
MsgBar vbNullString, False
Exit Sub
ReplaceErr:
ShowError
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 = "Global Replace"
Property Get FORMCAPTION As String
'WAS: FORMCAPTION = "Global Replace"
FORMCAPTION = LoadResString(S272_Global_Replace)
End Property
'This was: Const BUTTON1 = "&OK"
Property Get BUTTON1 As String
BUTTON1 = "&OK"
End Property
'This was: Const BUTTON2 = "&Cancel"
Property Get BUTTON2 As String
'WAS: BUTTON2 = "&Cancel"
BUTTON2 = LoadResString(S84_Cancel)
End Property
'This was: Const Label1 = "&Table:"
Property Get Label1 As String
'WAS: Label1 = "&Table:"
Label1 = LoadResString(S526_Table)
End Property
'This was: Const Label2 = "&Field:"
Property Get Label2 As String
'WAS: Label2 = "&Field:"
Label2 = LoadResString(S238_Field)
End Property
'This was: Const LABEL3 = "&Replace With:"
Property Get LABEL3 As String
'WAS: LABEL3 = "&Replace With:"
LABEL3 = LoadResString(S455_Replace_With)
End Property
'This was: Const LABEL4 = "Cr&iteria:"
Property Get LABEL4 As String
'WAS: LABEL4 = "Cr&iteria:"
LABEL4 = LoadResString(S122_Cr_iteria)
End Property
'This was: Const MSG1 = "Replacing Records"
Property Get MSG1 As String
'WAS: MSG1 = "Replacing Records"
MSG1 = LoadResString(S457_Replacing_Records)
End Property
Private Sub frmReplace_Auto_Init()
'This routine initializes all User Interface control properties on frmReplace.
'This section of code was automatically generated by the ResMe String Extraction Utility.
'WAS: Me.Caption = "Replace"
Me.Caption = LoadResString(S454_Replace)
'WAS: cmdOK.Caption = "&OK"
cmdOK.Caption = LoadResString(S355_OK)
'WAS: cmdCancel.Caption = "&Cancel"
cmdCancel.Caption = LoadResString(S84_Cancel)
'WAS: lblLabels(0).Caption = "Table:"
lblLabels(0).Caption = LoadResString(S527_Table)
'WAS: lblLabels(3).Caption = "Criteria:"
lblLabels(3).Caption = LoadResString(S123_Criteria)
'WAS: lblLabels(2).Caption = "Replace With:"
lblLabels(2).Caption = LoadResString(S456_Replace_With)
'WAS: lblLabels(1).Caption = "Field:"
lblLabels(1).Caption = LoadResString(S239_Field)
End Sub