Results 1 to 2 of 2

Thread: Help with SQL Select Statement

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    16
    I am writing a program for class, and it requires that we write and SQL SELECT statement. I thought I typed it in correctly, but the computer thinks otherwise. I get an error 3141 - The select statement includes a reserved word or an argument name that is either missing or mispelled, or the puncutation is incorrect. Here is what my code looks like. intCustomer is the customerid number entered earlier in program by user:

    pstrFROM = " FROM tblCustomer"
    pstrWHERE = " WHERE fldCustomerID = " & "'" & intCustomerNumber & "'"

    psqlSelect = "SELECT" & pstrFROM & pstrWHERE
    Set gdbMentorRecords = _
    Module1.gdbMentor.OpenRecordset(psqlSelect)

    Any help would greatly appreciated!
    Thanks
    Rachael

  2. #2
    Member
    Join Date
    Jan 1999
    Location
    Vancouver, BC, Canada
    Posts
    32
    After your SELECT statement, you need to specify some criteria.
    Example:

    SELECT * FROM yourtablename or
    SELECT name, address, phone FROM yourtablename

    In your case, your SQL statement has no criteria. It looks like this:
    SELECT FROM tblCustomer WHERE........

    So the program doesn't know *WHAT* you want to select!

Posting Permissions

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



Click Here to Expand Forum to Full Width