B
Bill
Hi
I have a question if that is possible to use the code begins and ends into Find Button from the form to look RecordNumber either Table or Query. I copy the code "Find button" if you can help me to insert the code "Begin to End" insert the code of "Find Button". Please let me know if it will work or not.
********** Find Button *******************
Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click
Me.Filter = ""
Me.FilterOn = False
'Screen.PreviousControl.SetFocus
Me.RecordNo.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_cmdFind_Click:
Exit Sub
Err_cmdFind_Click:
MsgBox Err.Description
Resume Exit_cmdFind_Click
End Sub
***************************************************************************************
'Code Begins
Function replace(fld As String, find As String, Optional repwith As String =
"") As String
Dim fldLen As Long
fldLen = Len(fld)
Dim findLen As Long
findLen = Len(find)
Dim newFld As String
newFld = ""
Dim x As Long
For x = 1 To fldLen
If Mid(fld, x, findLen) = find Then
newFld = newFld & repwith
x = x + findLen - 1
Else
newFld = newFld + Mid(fld, x, 1)
End If
Next
replace = newFld
End Function
'Code ends
I have a question if that is possible to use the code begins and ends into Find Button from the form to look RecordNumber either Table or Query. I copy the code "Find button" if you can help me to insert the code "Begin to End" insert the code of "Find Button". Please let me know if it will work or not.
********** Find Button *******************
Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click
Me.Filter = ""
Me.FilterOn = False
'Screen.PreviousControl.SetFocus
Me.RecordNo.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_cmdFind_Click:
Exit Sub
Err_cmdFind_Click:
MsgBox Err.Description
Resume Exit_cmdFind_Click
End Sub
***************************************************************************************
'Code Begins
Function replace(fld As String, find As String, Optional repwith As String =
"") As String
Dim fldLen As Long
fldLen = Len(fld)
Dim findLen As Long
findLen = Len(find)
Dim newFld As String
newFld = ""
Dim x As Long
For x = 1 To fldLen
If Mid(fld, x, findLen) = find Then
newFld = newFld & repwith
x = x + findLen - 1
Else
newFld = newFld + Mid(fld, x, 1)
End If
Next
replace = newFld
End Function
'Code ends