User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Feb 2005
Location: London, UK
Posts: 236
Reputation: uniquestar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 11
uniquestar's Avatar
uniquestar uniquestar is offline Offline
Daniweb Sponsor

Help ADO Data Control (ADODC) Problems with .recordset.find

  #1  
Feb 25th, 2005
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!!!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Solution Re: ADO Data Control (ADODC) Problems with .recordset.find

  #2  
Feb 25th, 2005
Can you show a bit of your code behind your form? I presume your building this in VB6 studio?

I can help you, just hang in there, give me a little more info. while i re-install vs 6.

I did something similar but I havn't touched data controls for about 4 years
Reply With Quote  
Join Date: Feb 2005
Location: London, UK
Posts: 236
Reputation: uniquestar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 11
uniquestar's Avatar
uniquestar uniquestar is offline Offline
Daniweb Sponsor

Re: ADO Data Control (ADODC) Problems with .recordset.find

  #3  
Feb 25th, 2005
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
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: ADO Data Control (ADODC) Problems with .recordset.find

  #4  
Feb 25th, 2005
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).
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 108
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: ADO Data Control (ADODC) Problems with .recordset.find

  #5  
Feb 25th, 2005
Are you sure the control is pointing to the same directory and file path as it does on your own computer?
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: ADO Data Control (ADODC) Problems with .recordset.find

  #6  
Feb 25th, 2005
That would error before you reached the call to the find method.
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 108
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: ADO Data Control (ADODC) Problems with .recordset.find

  #7  
Feb 25th, 2005
Hmn.... ok. And You are sure that the .mdb is the same one that you are using at home, and not corrupted in any way? (I know it seems like simple stuff, but the best of us forget the simple stuff some times)
Reply With Quote  
Join Date: Feb 2005
Location: London, UK
Posts: 236
Reputation: uniquestar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 11
uniquestar's Avatar
uniquestar uniquestar is offline Offline
Daniweb Sponsor

Re: ADO Data Control (ADODC) Problems with .recordset.find

  #8  
Feb 25th, 2005
yeah, the database is the same, i just recreated the program at college and changed the paths to match, i just am really confused why one code works in one place but not another!!
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 108
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: ADO Data Control (ADODC) Problems with .recordset.find

  #9  
Feb 25th, 2005
It should either not work on both, or work on both.... have you tried copying the from home and bringing it to the school? (instead of the recreation)
Reply With Quote  
Join Date: Feb 2005
Location: London, UK
Posts: 236
Reputation: uniquestar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 11
uniquestar's Avatar
uniquestar uniquestar is offline Offline
Daniweb Sponsor

Re: ADO Data Control (ADODC) Problems with .recordset.find

  #10  
Feb 25th, 2005
Yeah, I 4got to take my flashdisk with me, I'm going to try that when i'm next in on tuesday.
Cheers
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 6:06 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC