Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

DoCmd.RunSql "Select * from abc"

Discussion in 'Information Technology' started by Mohammed, Jul 28, 2006.

  1. Mohammed

    Mohammed
    Expand Collapse
    Guest

    When I am using this kind of query in form, I am getting errors... that it
    can not run with the select statement... Please help me....
     
  2. Loading...


  3. Sarah Schreffler

    Sarah Schreffler
    Expand Collapse
    Guest

    Mohammed wrote:
    > When I am using this kind of query in form, I am getting errors... that it
    > can not run with the select statement... Please help me....


    If you look up RunSQL in Access, you'll find it can not run with the
    Select statement.

    It is used to run action queries (queries that copy or change data) and
    data-definition queries (that create or alter objects in the database)

    If all you want to do is view the data, then you need to create a form
    with the query as the background, and create fields. If you put it in
    Default View: continuous forms, then you can view all the data in the
    query by scrolling back and forth.

    --Sarah Schreffler
     
  4. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    RunSQL can only be used with "action" queries: INSERT INTO, DELETE, UPDATE.

    What are you hoping will be the result of running the SELECT query?

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "Mohammed" <Mohammed@discussions.microsoft.com> wrote in message
    news:747C59B0-C525-403C-90DA-4863F3FEF6D1@microsoft.com...
    > When I am using this kind of query in form, I am getting errors... that it
    > can not run with the select statement... Please help me....
     
  5. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "Mohammed" <Mohammed@discussions.microsoft.com> wrote in message
    news:747C59B0-C525-403C-90DA-4863F3FEF6D1@microsoft.com
    > When I am using this kind of query in form, I am getting errors...
    > that it can not run with the select statement... Please help me....


    RunSQL only works with action queries, such as update, append, delete,
    and make-table queries; it doesn't work with SELECT queries. What do
    you want to do with your SELECT query? If you want to get data from it
    for further processing, you may need to open a recordset on the
    statement; if you want to display the results in a datasheet, you may
    need to stuff it into a stored query and open that stored query using
    DoCmd.OpenQuery.

    --
    Dirk Goldgar, MS Access MVP
    www.datagnostics.com

    (please reply to the newsgroup)
     
  6. Mohammed

    Mohammed
    Expand Collapse
    Guest

    Actually I would like to check in this file... If this file is empty then
    ..... else .....
    How I can do that please help me...


    "Douglas J. Steele" wrote:

    > RunSQL can only be used with "action" queries: INSERT INTO, DELETE, UPDATE.
    >
    > What are you hoping will be the result of running the SELECT query?
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no private e-mails, please)
    >
    >
    > "Mohammed" <Mohammed@discussions.microsoft.com> wrote in message
    > news:747C59B0-C525-403C-90DA-4863F3FEF6D1@microsoft.com...
    > > When I am using this kind of query in form, I am getting errors... that it
    > > can not run with the select statement... Please help me....

    >
    >
    >
     
  7. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    If you want to know how many rows are in a table, you can use DCount:

    If DCount("*", "abc") = 0 Then
    ' There's no data
    Else
    ' There's data
    End If

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Mohammed" <Mohammed@discussions.microsoft.com> wrote in message
    news:B8D7C12C-C0D0-4D1E-B03A-A870E776F3D5@microsoft.com...
    > Actually I would like to check in this file... If this file is empty then
    > .... else .....
    > How I can do that please help me...
    >
    >
    > "Douglas J. Steele" wrote:
    >
    > > RunSQL can only be used with "action" queries: INSERT INTO, DELETE,

    UPDATE.
    > >
    > > What are you hoping will be the result of running the SELECT query?
    > >
    > > --
    > > Doug Steele, Microsoft Access MVP
    > > http://I.Am/DougSteele
    > > (no private e-mails, please)
    > >
    > >
    > > "Mohammed" <Mohammed@discussions.microsoft.com> wrote in message
    > > news:747C59B0-C525-403C-90DA-4863F3FEF6D1@microsoft.com...
    > > > When I am using this kind of query in form, I am getting errors...

    that it
    > > > can not run with the select statement... Please help me....

    > >
    > >
    > >
     

Share This Page