Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    1

    Unhappy Unanswered: DoCmd.RunSQL "Select *

    Hey

    I have a problem using Access 2000 (DK)
    I want to select (and display on screen in a table) some posts from an existing table.
    I a'm trying this:

    Dim SQLstring as string
    SQLstring = "SELECT Backup.ID, Backup.Effekt, Backup.W
    FROM Backup;"
    DoCmd.RunSQL SQLstring

    But i keeps returning an error command saying: "Please insert a valid
    SQL expression"

    And i can't figur out what is wrong.

    Does anyone have an alternative idea, or know how to get this working?

    (Have also tried more directly using:
    DoCmd.RunSQL "SELECT Backup.ID, Backup.Effekt, Backup.W FROM Backup;"
    )

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: DoCmd.RunSQL "Select *

    Originally posted by s021788
    Hey

    I have a problem using Access 2000 (DK)
    I want to select (and display on screen in a table) some posts from an existing table.
    I a'm trying this:

    Dim SQLstring as string
    SQLstring = "SELECT Backup.ID, Backup.Effekt, Backup.W
    FROM Backup;"
    DoCmd.RunSQL SQLstring

    But i keeps returning an error command saying: "Please insert a valid
    SQL expression"

    And i can't figur out what is wrong.

    Does anyone have an alternative idea, or know how to get this working?

    (Have also tried more directly using:
    DoCmd.RunSQL "SELECT Backup.ID, Backup.Effekt, Backup.W FROM Backup;"
    )
    Th RunSQL is used to UPDATE a field, DELETE data from a table or CREATE a table, INSERT int a table
    i.e action Queries

  3. #3
    Join Date
    Dec 2003
    Posts
    268
    I would just create a subform with a table displayed as a datasheet. Then set the recordsource for the form =

    "SELECT Backup.ID, Backup.Effekt, Backup.W FROM Backup"

    YOu can either do this by putting the above line in the recordsource line of the form or you could just use the QBE to build the SQL string.

    HTH

    Matt Weyland

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by mjweyland
    I would just create a subform with a table displayed as a datasheet. Then set the recordsource for the form =

    "SELECT Backup.ID, Backup.Effekt, Backup.W FROM Backup"

    YOu can either do this by putting the above line in the recordsource line of the form or you could just use the QBE to build the SQL string.

    HTH

    Matt Weyland
    But yu used the DoCmd.RunSQL. In the fact you don't need to use it, just set the RecordSource of your Subform to the sql.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •