Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Search ('Find' command button) on database

Posted on 1998-08-05
9
Medium Priority
?
140 Views
Last Modified: 2010-05-03
I am currently taking a class.  My assignment was to create a program using data controls and a database.  
When the program is running, I need to have the capability to press the "Find" command button and have a search
done on the data base that I created.  Here is my example that is not working...  Please tell me what I am doing wrong.

Private Sub cmdFind_Click()
prompt$ = "Please enter the book title."
    'To do a title search
    SearchStr$ = InputBox(prompt$, "Book Search")
    datBooks.Recordset.FindFirst "Title"
    If datBooks.Recordset.NoMatch Then
        MsgBox ("Sorry buddy, your out of luck.")
        datBooks.Recordset.MoveFirst
    End If
End Sub


Thank you!



0
Comment
Question by:luna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 2

Expert Comment

by:percosolator
ID: 1468057
could you be more descriptive of what you are doing, the error messages, the table layout, error messages, results (or lack of), etc.

Is it a compile problem, run-time error, not doing what you intended....?
0
 

Author Comment

by:luna
ID: 1468058
I am getting a 'Run Time Error 3251, Operation is not supported for this type of object.  Sorry if I am not specific enough.  I am a newbie at programming.  Thanks for your help!
0
 
LVL 2

Expert Comment

by:percosolator
ID: 1468059
No problem with helping.

Which line does the program stop at?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:luna
ID: 1468060
When I ran debug, it is getting stuck on the statement
    datBooks.Recordset.FindFirst "Title"  Maybe I don't have my variable correctly set?

0
 
LVL 2

Expert Comment

by:percosolator
ID: 1468061
Comments:

Private Sub cmdFind_Click()
prompt$ = "Please enter the book title."
    'To do a title search
    SearchStr$ = InputBox(prompt$, "Book Search")

                               ---Shouldn't this be "SearchStr$"? not "title"
    datBooks.Recordset.FindFirst "Title"
    If datBooks.Recordset.NoMatch Then
        MsgBox ("Sorry buddy, your out of luck.")
        datBooks.Recordset.MoveFirst
    End If
End Sub
0
 
LVL 2

Accepted Solution

by:
percosolator earned 200 total points
ID: 1468062
Try this:

datBooks.Recordset.FindFirst "Title = '" & SearchStr$ & "'"

BTW, it's disgusting how you are using me.... <g>
0
 

Author Comment

by:luna
ID: 1468063
I thought you guys liked being used...  THANK YOU FOR ALL OF YOUR HELP!
0
 

Author Comment

by:luna
ID: 1468064
:-}
0
 
LVL 2

Expert Comment

by:percosolator
ID: 1468065
depends.... <g>
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question