Search "Find Button"

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
 
A

Alick [MSFT]

It seems you would like to find some specific record? if so please refer to
the article:

ACC2000: How to Find a Record Using ADO and Jet OLE DB Provider
http://support.microsoft.com/?id=199304



Sincerely,

Alick Ye, MCSD
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.



--------------------
| From: "Bill" <[email protected]>
| Newsgroups: microsoft.public.access.formscoding
| NNTP-Posting-Host: 63.138.119.7
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| 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
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top