[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DataGrid Question

Posted on 2002-03-22
6
Medium Priority
?
290 Views
Last Modified: 2010-05-02
Hi,
I've bound a datagrid to a recordset.
The recordset is coming from a query based on search criteria?
I've successfully bound the recordset to the datagrid.

Now, I have a button that if u click it'll go to the next one row in the datagrid that matches the search criteria.
If you click another button, it'll also goto previous row matching the criteria?
I'm having a trouble implmenting this feature.
Can someone shed a light on how I can do?
I believe I need to use recordset.find to go to next bookmark?
0
Comment
Question by:StriderX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6888083
A recordset? using ADO or DAO? Any codes available? ..
0
 
LVL 39

Expert Comment

by:appari
ID: 6888087
if using ADODC

for backward search
Adodc1.Recordset.Find "EmployeeID=" & Text1.Text, , adSearchBackward

for forward search

Adodc1.Recordset.Find "EmployeeID=" & Text1.Text, , adSearchForward


replace find criteria with yours.
0
 

Author Comment

by:StriderX
ID: 6889450
I am using adodb.recordset and bound it to datagrid.
After forward and backward searching, how do I set the selected index to be on the DataGrid that match the same row?

Also, I 'd appreciate if someone could answer the question of how to get the index of datagrid when user double clicks?
When I use index or some other property it always gives me the previous index before I double clicked.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6891876
Please maintin your open questions:

Questions Asked 14
Last 10 Grades Given A A A B A B B A  
Question Grading Record 8 Answers Graded / 8 Answers Received

Thanks,
Anthony
0
 
LVL 1

Accepted Solution

by:
Ege earned 800 total points
ID: 6898686
I think , this works like you want
but you need some controls  
1-ADODC
2-DATAGRID
3-two COMMAND BUTTON
1-TEXTBOX
GOOD LUCK
''COPY HERE

Dim rowcount As Long

Private Sub Command1_Click()
On Error Resume Next 'must
Dim j As Long
For j = 0 To rowcount - 2

DataGrid1.Row = DataGrid1.Row + 1


 If DataGrid1.Text = Text1.Text Then Exit Sub

Next
End Sub


Private Sub Command2_Click()
On Error Resume Next 'must
Dim j As Long
For j = rowcount To 0 Step -1
If DataGrid1.Row = 0 Then Exit Sub Else DataGrid1.Row = DataGrid1.Row - 1

DataGrid1.Scroll 0, DataGrid1.Row - 3
 If DataGrid1.Text = Text1.Text Then Exit Sub

Next
End Sub

Private Sub Form_Load()
On Error GoTo tolga

 
Do Until Err.Number <> 0
       
       rowcount = rowcount + 1
       DataGrid1.Row = DataGrid1.Row + 1
Loop

tolga:
For j = rowcount To 0 Step -1

If DataGrid1.Row = 0 Then Exit Sub Else DataGrid1.Row = DataGrid1.Row - 1

DataGrid1.Scroll 0, DataGrid1.Row - 3
 
 
Next
Debug.Print rowcount
DataGrid1.Row = 0
Err.Number = 0
Exit Sub
End Sub



0
 

Author Comment

by:StriderX
ID: 6910754
Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question