Results 1 to 3 of 3

Thread: DataEnvironment and SQL

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    Buffalo,NY
    Posts
    8
    I have a DataEnvironment set up with one command and on child command if I run a report with no sql it works fine it takes data from both ,I would like to set up an sql but I am having a problem getting the results I want for example: I have 2 tables in my database "color" and "shapes"
    and DataEnvironment is set up as Color as command and shapes as child command I want to select the color and have the shape as well on a report "red" "triangle"
    I tried doing the following"
    DataEnvironment1.commands("color").commandtext= _
    "SELECT * FROM shapes,colors WHERE color= '"&Search$&"'"

    but this generates an error "The specified field "color" could refer to more than one table specifed in your FROM clause" The color field is what I used to create the child command with...any ideas?

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    It sounds like the field "color" belongs to both tables. If this is so, the parser is telling you it needs help to tell it which field to use. You have another prblem in that you're collecting data from two tables but not joining them. This will lead to you getting a ton of data, redundant, that you won't be expecting. Assuming that "color" is a field common to both tables, the following query is more what you need:


    "SELECT * FROM shapes a , colors b WHERE a.color=b.color and b.color= '"&Search$&"'"


  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    Buffalo,NY
    Posts
    8
    I did what you suggested but but when I ran the report an error came up "Datafield color.color not found" I removed the the sql and the report printed the shapes and colors ..all of them what am I doing wrong?

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