Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 159321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:50:17+00:00 2026-05-11T10:50:17+00:00

I wrote a program that would add, delete, save and search through records in

  • 0

I wrote a program that would add, delete, save and search through records in a database (recordset). However I was doing it in a team. My task was to add the search function to the program, which I have; however I am having problems with adding an error message for when somebody types a word/anything that isn’t in the database/recordset.

So for example in the textbox(txtFindBox.Text) if they type ‘ashbndash’ it would come up with an error message. I’ve commented out my own error message boxes but tell me where I’m going wrong please 🙁

Here’s the code for the find button.

Private Sub cmdFindDB_Click() adoCustomer.Recordset.MoveFirst If optLastName.Value = True Then adoCustomer.Recordset.Find 'LastName='' & txtFindBox.Text & ''' 'Else 'MsgBox ('NO RECORD FOUND') End If If OptFirstName.Value = True Then adoCustomer.Recordset.Find 'FirstName='' & txtFindBox.Text & ''' 'Else 'MsgBox ('NO RECORD FOUND') End If End Sub 

edit: Just like to say the problem is that every time I hit the button ‘find’ it comes up with the message ‘NO RECORD FOUND’ in a msgbox even though it finds the answer, it also comes up with that msgbox if you type in gibberish too.

Thanks for your time

Regards Haroon

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:50:18+00:00Added an answer on May 11, 2026 at 10:50 am

    Here is an example of how to do what you are trying to do: METHOD: Recordset::Find

    Example for your code:

    adoCustomer.Recordset.MoveFirst adoCustomer.Recordset.Find 'LastName='' & txtFindBox.Text & ''' If (adoCustomer.Recordset.BOF = True) OR (adoCustomer.Recordset.EOF = True) Then    MsgBox 'Record not found' End If 

    Instead of checking that the Value property is true, you need to check EOF and BOF. These stand for End Of File and Beginning Of File. So if either is true, then you are not ‘inside’ the recordset, meaning you did not find anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer ‘function cat’ is just a function. Its prototype is an… May 11, 2026 at 1:04 pm
  • added an answer Use Url.Action as the first parameter. // link to a… May 11, 2026 at 1:04 pm
  • added an answer The first declares that a class has runtime type info… May 11, 2026 at 1:04 pm

Related Questions

I want to write a program that would print every combination of a set
I would like to write a program that will identify a machine( for licensing
I wrote a sample program at http://codepad.org/ko8vVCDF that uses a template function. How do
I have to write a program that read from a file that contains the
I want to write a small program that should print something like testing CPU...
When I realized I needed to create an index for approximately 50 XHTML pages,
There are several topics about what questions will be raised in an interview for
Here's the background. I'm sorry it's so long: I do SAS programming for 3
First a bit about the environment: We use a program called Clearview to manage

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.