| | |
Find Record
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
Hello pranav,
you are providing very poor information,
with this people can't help you without properly understanding your problem/requirement,
I am answering with my assumption
Assumption:
You have a Recordset named "RS"
The Search text is in the string variable "SrchText"
The Searchnumber is in the integer variable "SrchNumt"
and the record set has 3 field
1.RecordID
2.Name(srchText)
3.RegNumber(srchNum)
then follow the code to find the record
i hope this code will help you,
with regards
Venkatramasamy SN
you are providing very poor information,
with this people can't help you without properly understanding your problem/requirement,
I am answering with my assumption
Assumption:
You have a Recordset named "RS"
The Search text is in the string variable "SrchText"
The Searchnumber is in the integer variable "SrchNumt"
and the record set has 3 field
1.RecordID
2.Name(srchText)
3.RegNumber(srchNum)
then follow the code to find the record
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
rs.movefirst for i=0 to rs.recordcount-1 if strcomp(rs!Name,srchtext,vbTextcompare)=0 and strcomp(rs!RegNumber,srchnum,vbTextcompare)=0 then msgbox "Record found RecoedId: " & rs!RecordID,Vbinformation end if rs.movenext next
i hope this code will help you,
with regards
Venkatramasamy SN
Last edited by venkatramasamy; Jan 8th, 2008 at 5:42 am.
•
•
Join Date: Mar 2007
Posts: 24
Reputation:
Solved Threads: 0
hello venkatramasamy,
first of thnx for reply and
sorry for poor information.
i m generating form for receipt for the organisation. which covers filds like
RecptNo, Date, PartyName, Type of Income, Cash,Cheque etc
on the base of your coding i found the record but
as n when i click ok button. it shows all fields blank no data in any field
so, still i found problem. please try to help me. following is the coding
Private Sub cmdFind_Click()
rn = InputBox("Enter Receipt No", "Find")
'MsgBox (rn)
Adodc1.Recordset.MoveFirst
For j = 0 To Adodc1.Recordset.RecordCount - 1
If StrComp(Adodc1.Recordset.Fields("recno"), rn, vbTextCompare) = 0 Then
MsgBox "record found", vbInformation + vbOKOnly, "Record"
End If
Adodc1.Recordset.MoveNext
Next
End Sub
waiting for solution
first of thnx for reply and
sorry for poor information.
i m generating form for receipt for the organisation. which covers filds like
RecptNo, Date, PartyName, Type of Income, Cash,Cheque etc
on the base of your coding i found the record but
as n when i click ok button. it shows all fields blank no data in any field
so, still i found problem. please try to help me. following is the coding
Private Sub cmdFind_Click()
rn = InputBox("Enter Receipt No", "Find")
'MsgBox (rn)
Adodc1.Recordset.MoveFirst
For j = 0 To Adodc1.Recordset.RecordCount - 1
If StrComp(Adodc1.Recordset.Fields("recno"), rn, vbTextCompare) = 0 Then
MsgBox "record found", vbInformation + vbOKOnly, "Record"
End If
Adodc1.Recordset.MoveNext
Next
End Sub
waiting for solution
HI Pranav,
The problem is very simple and basic,
in your code you compared the data good,where yoiu assunged the data to dispaly..?
that is the problem
controls:
TxtRecpt-Textbox
Txtdate-Textbox
TxtPname-textBOx
cbmIncome-Combobox
assign the data to an control to distaple like datagrid or text box etc..
for example...
hope this code will help you,
With regards
Venkatramasamy SN
The problem is very simple and basic,
in your code you compared the data good,where yoiu assunged the data to dispaly..?
that is the problem
controls:
TxtRecpt-Textbox
Txtdate-Textbox
TxtPname-textBOx
cbmIncome-Combobox
assign the data to an control to distaple like datagrid or text box etc..
for example...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub form_load() cbmIncome.additem("Cash") cbmIncome.additem("Cheque") end sub Private Sub cmdFind_Click() rn = InputBox("Enter Receipt No", "Find") 'MsgBox (rn) Adodc1.Recordset.MoveFirst For j = 0 To Adodc1.Recordset.RecordCount - 1 If StrComp(Adodc1.Recordset.Fields("recno"), rn, vbTextCompare) = 0 Then TxtRecpt.text=Adodc1.Recordset.Fields("recno") Txtdate.text=Adodc1.Recordset.Fields("date") TxtPname.text=Adodc1.Recordset.Fields("Partyname") cbmIncome.text=Adodc1.Recordset.Fields("IncomeType") else MsgBox "No records available with the Enteres receipt no", vbInformation + vbOKOnly, "Record" End If Adodc1.Recordset.MoveNext Next end sub
hope this code will help you,
With regards
Venkatramasamy SN
•
•
Join Date: Mar 2007
Posts: 24
Reputation:
Solved Threads: 0
thnx for suggestion.
i made a little bit change
following code is working properly
Private Sub cmdFind_Click()
rn = InputBox("Enter Receipt No", "Find")
'MsgBox (rn)
Adodc1.Recordset.MoveFirst
For j = 0 To Adodc1.Recordset.RecordCount - 1
If StrComp(Adodc1.Recordset.Fields("recno"), rn, vbTextCompare) = 0 Then
MsgBox "record found", vbInformation + vbOKOnly, "Record"
Exit For
End If
Adodc1.Recordset.MoveNext
Next
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MovePrevious
End If
If Not StrComp(Adodc1.Recordset.Fields("recno"), rn, vbTextCompare) = 0 Then
MsgBox "Receipt No. not found", vbInformation + vbOKOnly, "Record"
End If
End Sub
is there any mistake then tell me??
againg thnx for this help.
- pranav
i made a little bit change
following code is working properly
Private Sub cmdFind_Click()
rn = InputBox("Enter Receipt No", "Find")
'MsgBox (rn)
Adodc1.Recordset.MoveFirst
For j = 0 To Adodc1.Recordset.RecordCount - 1
If StrComp(Adodc1.Recordset.Fields("recno"), rn, vbTextCompare) = 0 Then
MsgBox "record found", vbInformation + vbOKOnly, "Record"
Exit For
End If
Adodc1.Recordset.MoveNext
Next
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MovePrevious
End If
If Not StrComp(Adodc1.Recordset.Fields("recno"), rn, vbTextCompare) = 0 Then
MsgBox "Receipt No. not found", vbInformation + vbOKOnly, "Record"
End If
End Sub
is there any mistake then tell me??
againg thnx for this help.
- pranav
hi pranav,
are you tried my code or not,
the code you are furnished is correct,
i'll give one more suggestion
in my code in the "else" part of the "IF" condition use an boolean variable
The modified code will be like this...
reply me about the status
With regards
Venkatramasamy SN
are you tried my code or not,
the code you are furnished is correct,
i'll give one more suggestion
in my code in the "else" part of the "IF" condition use an boolean variable
The modified code will be like this...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub form_load() cbmIncome.additem("Cash") cbmIncome.additem("Cheque") end sub Private Sub cmdFind_Click() dim Rfound as boolean Rfound=false rn = InputBox("Enter Receipt No", "Find") 'MsgBox (rn) Adodc1.Recordset.MoveFirst For j = 0 To Adodc1.Recordset.RecordCount - 1 If StrComp(Adodc1.Recordset.Fields("recno"), rn, vbTextCompare) = 0 Then TxtRecpt.text=Adodc1.Recordset.Fields("recno") Txtdate.text=Adodc1.Recordset.Fields("date") TxtPname.text=Adodc1.Recordset.Fields("Partyname") cbmIncome.text=Adodc1.Recordset.Fields("IncomeType") Rfound=true Exit for else Rfound=false End If Adodc1.Recordset.MoveNext Next if Rfound=false then msgbox "ReceiptNumber Not found", Vbinformation end if end sub
reply me about the status
With regards
Venkatramasamy SN
•
•
Join Date: Mar 2007
Posts: 24
Reputation:
Solved Threads: 0
hi,
ya that one is also working.
but as and when record found, it shows all the fields with the proper data. no need to transfer to textbox or to combobox or other objects. its coming automatically.
boolean concept is againg proper with else if. that is also working
againg thnx for such valuable help. bcaz i m making this form and other part of softr not for professional purpose but for the devotional purpose. i m making one software on account base for the Temple. Receipt and Expense for the Temple
so thnx for the help
ya that one is also working.
but as and when record found, it shows all the fields with the proper data. no need to transfer to textbox or to combobox or other objects. its coming automatically.
boolean concept is againg proper with else if. that is also working
againg thnx for such valuable help. bcaz i m making this form and other part of softr not for professional purpose but for the devotional purpose. i m making one software on account base for the Temple. Receipt and Expense for the Temple
so thnx for the help
![]() |
Similar Threads
- Need Help with ASP (ASP)
- help a newbie? mySQL find & replace (MySQL)
- datagrid find record code - what's wrong?? (VB.NET)
- Searching a record (Pascal and Delphi)
- Searching a record in 3 tables (Visual Basic 4 / 5 / 6)
- Searching for a record in multiple tables (VB.NET)
- assignment help [fstream, on modifying a record in a file] (C++)
- Create Windows Authentication (VB.NET)
- Find and Replace (Database Design)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Convert string variable into form object in VB6
- Next Thread: Error 998 in VB6 on Vista Home Premium
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





