•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 426,517 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,086 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 22359 | Replies: 15
![]() |
| |
Hi, I am using the Microsoft ADO Data Control 6.0 and connectiong to my database using Microsoft Jet 4.0. My fields are being outputted into labels.
I have a tex box called text1 and a command button called cmdsearch
I wand to be able to search through my database and pick out a perticular record. PLEASE HELP!!!!!!!!
A LEVEL COURSEWORK DEPENDS ON IT!!!!
I have a tex box called text1 and a command button called cmdsearch
I wand to be able to search through my database and pick out a perticular record. PLEASE HELP!!!!!!!!
A LEVEL COURSEWORK DEPENDS ON IT!!!!
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation:
Rep Power: 7
Solved Threads: 59
Hi, this code is behind a command button, and workd when i'm @ home, but the same code will not work when at college, when i hit debug it highlights "adodc1.recordset.find tr"
Private Sub Command2_Click()
On Error GoTo abc
Dim tr As String
tr = InputBox("Criteria to Find", "Find")
If Len(Trim(tr)) > 0 Then
tr = "Title='" & UCase(Trim(tr)) & "'"
Adodc1.Recordset.Find tr
If Adodc1.Recordset.EOF = True Then
MsgBox "Record was not Found", vbInformation + vbOKOnly, "No Match"
Adodc1.Recordset.MoveFirst
End If
Exit Sub
abc:
MsgBox Err.Description
End If
End Sub
Cheers,
Jon
Private Sub Command2_Click()
On Error GoTo abc
Dim tr As String
tr = InputBox("Criteria to Find", "Find")
If Len(Trim(tr)) > 0 Then
tr = "Title='" & UCase(Trim(tr)) & "'"
Adodc1.Recordset.Find tr
If Adodc1.Recordset.EOF = True Then
MsgBox "Record was not Found", vbInformation + vbOKOnly, "No Match"
Adodc1.Recordset.MoveFirst
End If
Exit Sub
abc:
MsgBox Err.Description
End If
End Sub
Cheers,
Jon
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation:
Rep Power: 7
Solved Threads: 59
Well it works fine for me too here!
What is the error text from debug ?
I note F1 on the Find method gets me nothing from MSDN Library which is disconcerting.
What ADO library have you got referenced (Project> references...) ?
Try simplifying the logic around your search string tr, I don't see the need for UCase as the search is not case sensitive by default and there's no need to test len(tr) because if it's blank your EOF test will handle the problem. I always try to code KISS (Keep It Simple Stupid).
What is the error text from debug ?
I note F1 on the Find method gets me nothing from MSDN Library which is disconcerting.
What ADO library have you got referenced (Project> references...) ?
Try simplifying the logic around your search string tr, I don't see the need for UCase as the search is not case sensitive by default and there's no need to test len(tr) because if it's blank your EOF test will handle the problem. I always try to code KISS (Keep It Simple Stupid).
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 108
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation:
Rep Power: 7
Solved Threads: 59
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 108
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 108
![]() |
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Hello....... Code Masters
- Next Thread: final project



Hybrid Mode