hi friends,
i am having one problem in data grid.
what i am have done is i made a button for "find" for searching for a particular record and when i found that record i point the record selector at that record that record.it is working fine.
but now the problem is that when i search for a record that is not currently visible on a data grid it will search that record and point the record selector at that record and when i again click on find button and give some record to search it takes the record of current screen as the first record and point to wrong record.
can u plz tell me how i will point the record in the screen
i am sending my code::
Private Sub find_Click()
Dim ans1, f As String
Dim flag, i,b, j As Integer
b=0
datagrid1.row=0
i = 0
j = 0
flag = 1
f = InputBox("Enter what do u want to search", "Find"
AdoRs.MoveFirst
Do While Not AdoRs.EOF
If AdoRs!cdno = f Then
flag = 2
Exit Do
else
b=b+1
adors.movenext
endif
Loop
If flag = 2 Then
DataGrid1.Row = b
End If
If flag = 1 Then
MsgBox "This record does not exist", , ""
End If
AdoRs.MoveFirst
end sub
plz suggest me some sol.
regards
akshita
i am having one problem in data grid.
what i am have done is i made a button for "find" for searching for a particular record and when i found that record i point the record selector at that record that record.it is working fine.
but now the problem is that when i search for a record that is not currently visible on a data grid it will search that record and point the record selector at that record and when i again click on find button and give some record to search it takes the record of current screen as the first record and point to wrong record.
can u plz tell me how i will point the record in the screen
i am sending my code::
Private Sub find_Click()
Dim ans1, f As String
Dim flag, i,b, j As Integer
b=0
datagrid1.row=0
i = 0
j = 0
flag = 1
f = InputBox("Enter what do u want to search", "Find"
AdoRs.MoveFirst
Do While Not AdoRs.EOF
If AdoRs!cdno = f Then
flag = 2
Exit Do
else
b=b+1
adors.movenext
endif
Loop
If flag = 2 Then
DataGrid1.Row = b
End If
If flag = 1 Then
MsgBox "This record does not exist", , ""
End If
AdoRs.MoveFirst
end sub
plz suggest me some sol.
regards
akshita