VB icon

A Distinct Search

Email
Submitted on: 1/9/2015 12:27:00 AM
By: Anil Iyengar (from psc cd)  
Level: Beginner
User Rating: By 19 Users
Compatibility: VB 6.0
Views: 2099
 
     This a Search program that searches for a 'specific record in a database. This is a kind of DISTINCT search. Where u just have to enter the first letter of the data u want and it gives u an output in the grid.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: A Distinct Search
' Description:This a Search program that searches for a
'specific record in a database.
This is a kind of DISTINCT search.
Where u just have to enter the first letter of the data u want and it gives u an output in the grid.
' By: Anil Iyengar (from psc cd)
'
' Inputs:'Im using a MSHFlexGrid with a ADO DataControl.
'Connect the ADODC to the Biblio.mdb
'Set Recordsource to Publisers .
'
' Returns:A Specific Row of data.
'
' Assumes:im using the Mid function.
Get ADODC and connect to Biblio.mdb.
'**************************************

Private Sub Command1_Click()
Unload Me 'Unload the program
End
End Sub
Private Sub Form_Load()
'set the Colwidth of the grid
fg.ColWidth(0) = 550
fg.ColWidth(1) = 3000
fg.ColWidth(2) = 3000
End Sub
Private Sub Text1_Change()
Adodc1.RecordSource = "select PubID,Name,[Company Name] from publishers where ucase(mid(pubid,1," & Len(Text1.Text) & "))= '" & Text1.Text & "' and ucase(mid(name,1," & Len(Text2.Text) & "))= '" & Text2.Text & "'"
Adodc1.Refresh
fg.SelectionMode = flexSelectionByRow
'The mid function checkes the records according
'to the info typed in the textbox.
'It queries the ADODC with every letter typed
'in the textbox,making it a bit more refined
'search on the records.
End Sub
Private Sub Text2_Change()
Adodc1.RecordSource = "select PubID,Name,[Company Name] from publishers where ucase(mid(name,1," & Len(Text2.Text) & "))= '" & Text2.Text & "'"
Adodc1.Refresh
fg.SelectionMode = flexSelectionByRow
End Sub
'Just use the mid function as i have and
'you can query any database for the record.
'This kind of search is useful if the u have to
'go thru a large database.
'PLEASE VOTE


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.