ORIGINAL SOURCE CODE FOR REPLACE.FRM

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

http://www.resourcemining.com

REPLACE.FRM contained 15 resource strings and 9 non-user interface strings.

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
    sWhereCondition = " 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
    FORMCAPTION = "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
    BUTTON2 = "&Cancel"
End Property

'This was: Const Label1 = "&Table:"
Property Get Label1 As String
    Label1 = "&Table:"
End Property

'This was: Const Label2 = "&Field:"
Property Get Label2 As String
    Label2 = "&Field:"
End Property

'This was: Const LABEL3 = "&Replace With:"
Property Get LABEL3 As String
    LABEL3 = "&Replace With:"
End Property

'This was: Const LABEL4 = "Cr&iteria:"
Property Get LABEL4 As String
    LABEL4 = "Cr&iteria:"
End Property

'This was: Const MSG1 = "Replacing Records"
Property Get MSG1 As String
    MSG1 = "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.
    Me.Caption = "Replace"
    cmdOK.Caption = "&OK"
    cmdCancel.Caption = "&Cancel"
    lblLabels(0).Caption = "Table:"
    lblLabels(3).Caption = "Criteria:"
    lblLabels(2).Caption = "Replace With:"
    lblLabels(1).Caption = "Field:"
End Sub