• Display results of select query (Access (All))

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Display results of select query (Access (All))

    Author
    Topic
    #404254

    It seems that this should be easy to do, but I somehow I can’t see it!

    I have a table in which one of the fields contains an SQL select statement (it is used to configure a combo box “on-the-fly”). On the form that maintains this table, I want to put a little “Test” button next to the control that contains the SQL statement, so that the user can test that there are no errors and that it returns something. I would essentially like to do an OpenQuery, but there is no named query to run, only the SQL statement. (I could create a permanent named query and then just change the SQL property each time, enabling me to use the OpenQuery method; but that’s a last resort).

    Liked I said, it seems like it should be easy to do, but how?

    Viewing 1 reply thread
    Author
    Replies
    • #820971

      If you have a copy of the Access Developer’s Handbook take a look at the stuff on the CD – there’s an add-in named SQLScrat.mda that seems to do something like what you are looking for. In addition to several class modules, etc, there’s a form named frmSQLScratchpad that as name implies lets you run quick test to see if SQL statement returns expected results. See attached pic, tested with Northwind “Customers” table. You could always write your own utility to do this, but why invent wheel? (Note: this add-in was included on CD-ROM with the A2K version of ADH, don’t know about other versions of book.)

      If you don’t have a copy of the ADH, you should!

      HTH

      • #820985

        Thanks, I’ll give it a look. I don’t think I have ADH2000, though I do have it for a couple of earlier versions. I always thought they should offer a discount to “upgrade” to the latest version, but apparently not too many publishers think this is a good idea! go figure. Anyway, I’ll see if it is in the earlier versions. Seems like it should be a simple command or something that is readily available.

      • #820986

        Thanks, I’ll give it a look. I don’t think I have ADH2000, though I do have it for a couple of earlier versions. I always thought they should offer a discount to “upgrade” to the latest version, but apparently not too many publishers think this is a good idea! go figure. Anyway, I’ll see if it is in the earlier versions. Seems like it should be a simple command or something that is readily available.

    • #820972

      If you have a copy of the Access Developer’s Handbook take a look at the stuff on the CD – there’s an add-in named SQLScrat.mda that seems to do something like what you are looking for. In addition to several class modules, etc, there’s a form named frmSQLScratchpad that as name implies lets you run quick test to see if SQL statement returns expected results. See attached pic, tested with Northwind “Customers” table. You could always write your own utility to do this, but why invent wheel? (Note: this add-in was included on CD-ROM with the A2K version of ADH, don’t know about other versions of book.)

      If you don’t have a copy of the ADH, you should!

      HTH

    Viewing 1 reply thread
    Reply To: Display results of select query (Access (All))

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: