Finding NextRecord

  • Thread starter Thread starter 1aae
  • Start date Start date
1

1aae

Thank you
I have this code to Find record....
What Is the Problem of this code I can't use this code to Find Next Record If There..
Is there any one can help me to add feature to this code To Find Next Record If there Or what code needed to find NextRecord
Thank

Dim sbf As Form
Set sbf = Me![MysubForm].Form
With sbf.RecordsetClone
.FindFirst "EmployeeName= """ & Me.cboEmployeeName & """"
If Not .NoMatch Then
sbf.Bookmark = .Bookmark
End If
End With
 
I think you are asking:
If the employee name is not found, go to the next name after that.

If so, change your FindFirst line to:
.FindFirst "EmployeeName >= """ & Me.cboEmployeeName & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thank you
I have this code to Find record....
What Is the Problem of this code I can't use this code to Find Next Record
If There..
Is there any one can help me to add feature to this code To Find Next Record
If there Or what code needed to find NextRecord
Thank

Dim sbf As Form
Set sbf = Me![MysubForm].Form
With sbf.RecordsetClone
.FindFirst "EmployeeName= """ & Me.cboEmployeeName & """"
If Not .NoMatch Then
sbf.Bookmark = .Bookmark
End If
End With
 
Thank you for the help
I will Give you example
EmployeeName Section
Jacky Low A
Jacky Low B
dfhasdfjkh N

You see in the first 2 name is (the same name) I want code to Find First
Jacky Low and When Press Command Button Find Next Jacky Low

Thank You
 
The code you have should be fine if you just replace "FindFirst" with
"FindNext".

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.
1aae said:
Thank you for the help
I will Give you example
EmployeeName Section
Jacky Low A
Jacky Low B
dfhasdfjkh N

You see in the first 2 name is (the same name) I want code to Find First
Jacky Low and When Press Command Button Find Next Jacky Low

Thank You



Allen Browne said:
I think you are asking:
If the employee name is not found, go to the next name after that.

If so, change your FindFirst line to:
.FindFirst "EmployeeName >= """ & Me.cboEmployeeName & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thank you
I have this code to Find record....
What Is the Problem of this code I can't use this code to Find Next Record
If There..
Is there any one can help me to add feature to this code To Find Next Record
If there Or what code needed to find NextRecord
Thank

Dim sbf As Form
Set sbf = Me![MysubForm].Form
With sbf.RecordsetClone
.FindFirst "EmployeeName= """ & Me.cboEmployeeName & """"
If Not .NoMatch Then
sbf.Bookmark = .Bookmark
End If
End With
 
Thank you
The Code work correct thank you
May I ask you another question:
How can use this code also with this option (any part of the field- start of
the field - whole field)
Thank you and also thank you

Allen Browne said:
The code you have should be fine if you just replace "FindFirst" with
"FindNext".

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.
1aae said:
Thank you for the help
I will Give you example
EmployeeName Section
Jacky Low A
Jacky Low B
dfhasdfjkh N

You see in the first 2 name is (the same name) I want code to Find First
Jacky Low and When Press Command Button Find Next Jacky Low

Thank You



Allen Browne said:
I think you are asking:
If the employee name is not found, go to the next name after that.

If so, change your FindFirst line to:
.FindFirst "EmployeeName >= """ & Me.cboEmployeeName & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thank you
I have this code to Find record....
What Is the Problem of this code I can't use this code to Find Next Record
If There..
Is there any one can help me to add feature to this code To Find Next Record
If there Or what code needed to find NextRecord
Thank

Dim sbf As Form
Set sbf = Me![MysubForm].Form
With sbf.RecordsetClone
.FindFirst "EmployeeName= """ & Me.cboEmployeeName & """"
If Not .NoMatch Then
sbf.Bookmark = .Bookmark
End If
End With
 
Use the Like operator with wildcards:

..FindNext "EmployeeName Like ""*" & Me.cboEmployeeName & "*"""

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

1aae said:
Thank you
The Code work correct thank you
May I ask you another question:
How can use this code also with this option (any part of the field- start of
the field - whole field)
Thank you and also thank you

Allen Browne said:
The code you have should be fine if you just replace "FindFirst" with
"FindNext".

1aae said:
Thank you for the help
I will Give you example
EmployeeName Section
Jacky Low A
Jacky Low B
dfhasdfjkh N

You see in the first 2 name is (the same name) I want code to Find First
Jacky Low and When Press Command Button Find Next Jacky Low

Thank You



I think you are asking:
If the employee name is not found, go to the next name after that.

If so, change your FindFirst line to:
.FindFirst "EmployeeName >= """ & Me.cboEmployeeName & """"

Thank you
I have this code to Find record....
What Is the Problem of this code I can't use this code to Find Next Record
If There..
Is there any one can help me to add feature to this code To Find Next
Record
If there Or what code needed to find NextRecord
Thank

Dim sbf As Form
Set sbf = Me![MysubForm].Form
With sbf.RecordsetClone
.FindFirst "EmployeeName= """ & Me.cboEmployeeName & """"
If Not .NoMatch Then
sbf.Bookmark = .Bookmark
End If
End With
 
Thank you for your reply
I don't know the reason (The Last code not work with me)
thank you
Allen Browne said:
Use the Like operator with wildcards:

.FindNext "EmployeeName Like ""*" & Me.cboEmployeeName & "*"""

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

1aae said:
Thank you
The Code work correct thank you
May I ask you another question:
How can use this code also with this option (any part of the field-
start
of
the field - whole field)
Thank you and also thank you

Allen Browne said:
The code you have should be fine if you just replace "FindFirst" with
"FindNext".

Thank you for the help
I will Give you example
EmployeeName Section
Jacky Low A
Jacky Low B
dfhasdfjkh N

You see in the first 2 name is (the same name) I want code to Find First
Jacky Low and When Press Command Button Find Next Jacky Low

Thank You



I think you are asking:
If the employee name is not found, go to the next name after that.

If so, change your FindFirst line to:
.FindFirst "EmployeeName >= """ & Me.cboEmployeeName & """"

Thank you
I have this code to Find record....
What Is the Problem of this code I can't use this code to Find Next
Record
If There..
Is there any one can help me to add feature to this code To Find Next
Record
If there Or what code needed to find NextRecord
Thank

Dim sbf As Form
Set sbf = Me![MysubForm].Form
With sbf.RecordsetClone
.FindFirst "EmployeeName= """ & Me.cboEmployeeName & """"
If Not .NoMatch Then
sbf.Bookmark = .Bookmark
End If
End With
 
Allen Browne;
Thank you for your help and answer
The You give work correct
..FindNext "EmployeeName Like ""*" & Me.cboEmployeeName & "*"""
I don't know why first time not work
 
Back
Top