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 9267815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:38:44+00:00 2026-06-18T14:38:44+00:00

I have a search query that is displayed in a sub form that is

  • 0

I have a search query that is displayed in a sub form that is in datasheet view.

When selecting a record from this subform, I need to have users click a button (for tracking purposes) to access the record’s data on other parts of the form. Currently, the Access Record Button is set to enabled = true when the query runs (via a submit button).

The problem with this is that if a search yields no results, the access record button is still click-able and tries to access a record that doesn’t exist; giving me: “Run-time error 2427: You entered an expression that has no value”

Is there a way to disable that button if the query returns no results or if no record is selected?

EDIT: Code for the button at this point.

Private Sub cmdSubmit_Click()
Me!SearchResults.Form.RecordSource = "qryPendingCriteriaCIP"
Me!SearchResults.Form.Requery
Me!SearchResults.Form.Visible = True


If Forms!frm_SearchMulti!SearchResults.Form.RecordCount > 0 Then

Me.cmdExport.Enabled = True
Me.SearchResults.Enabled = True


Me.cmdPass.Enabled = True
Else
Exit Sub
End If

End Sub
  • 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. Editorial Team
    Editorial Team
    2026-06-18T14:38:46+00:00Added an answer on June 18, 2026 at 2:38 pm

    Is the button on the main form and do you mean you wish to check that there are records in the subform?

    If Me.MySubformControlName.Form.Recordset.RecordCount>0 Then
    

    Or to check a row:

    If Me.MySubformControlName.txtID ...
    

    Or to check the query:

    If DCount("*","qryPendingCriteriaCIP")=0 Then
        MsgBox "No results"
    Else
        Me.SearchResults.Form.RecordSource = "qryPendingCriteriaCIP"
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Gridview that displays paged results from a search query. The problem
I have a search query that looks like this: $sql=SELECT *, MATCH(item_tags, item_name, item_description)
I have this PHP code to highlight the Query on search results. if (isset($_REQUEST['k'])){
I have this query where I can search the TABLE_GLOBAL_PRODUCTS $catglobal_sql = select p.*,
I have this sql query: SELECT S.SEARCH, S.STATUS, C.TITLE AS CategoryName, E.SEARCH_ENGINES AS Engine,
I have built a T-SQL query like this: DECLARE @search nvarchar(1000) = 'FORMSOF(INFLECTIONAL,hills) AND
I have a search form that can search in different provider. I started out
We have some search functionality that can return tens of thousands of results from
I have a search script that retrieves an integer from one table and uses
I have a PHP and jQuery script that creates search result suggestions from a

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.