Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    21

    Unanswered: Create composite key in answer table

    I need to create a report based on some regular tables in my DB and a couple of answer tables that are created by running queries just before running the report. I made the queries in the standard QBE mode but can't figure out any way to get it to make fields in the answer table to be keys. I want a composite key made from the first two fields in the answer table.

    Of course I can go and restructure the answer table after running the query, and add the keys, but that is no good. I need to automate this so the answer table is generated and then used in the report.

    Is there any way to tell QBE to make an answer table field be a key?

  2. #2
    Join Date
    Sep 2003
    Location
    Dallas
    Posts
    182

    I know of only two ways to do it

    The first way is to create a script and automate the process. The script will of course go in and restructure the table.

    The second way (easier) is to use an append query and create the table permanently first. "Report_Table" Then create a query that does not create an answer table but inserts records into the report table. Which will already be keyed.

    By the way, do you know that you can create the report based on the Query instead of the answer table which would allow you some other flexibility?

  3. #3
    Join Date
    Jan 2004
    Posts
    21
    Thanks. That sent me in the right direction for what I needed. I read up on doing queries with delete and insert and ended up running 2 queries to build up the results I needed and then a query to delete the current contents of the final table and another query to insert the new data into the final table.

    There may have been an easier way to do it, but I got that done in an hour and I had spent days banging my head against the wall before posting the original message, so for me it was a quick fix. I couldn't get the insert to work directly from the first pair of queries because there were a number of calculated fields and Paradox wouldn't let me do inserts with "calc" in them.

  4. #4
    Join Date
    Sep 2003
    Location
    Dallas
    Posts
    182

    Well some help is better than none :-)

    By the way did you know that you can save the queries and then play them sequentially in a script which will still automate the process with a one button approach?

  5. #5
    Join Date
    Jan 2004
    Posts
    21
    Yes. That's what I was doing. I have a button that when pressed runs each query, one after the other, and then opens the report.

Posting Permissions

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