Re: Link table alternative

From: MGFoster (me_at_privacy.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 21:54:20 GMT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've found that it is better to import large text files rather than to
link to them. When linked Text Files, wierd errors appear that can't be
solved, except by importing the data to a temp table.

If your query is an actual query & not an example: the query can be
simplified as:

SELECT phsmgr, phscde, SUM(phscst) As Total
FROM tbl1
GROUP BY phsmgr, phscde

The subquery in the SELECT clause will return a record for each phscde
in tbl1, 'cuz you GROUPed BY phscde. That was the cause of the error
"only one record can be returned," which, confusingly, means that the
subquery should return ONLY one record, but is, in fact, returning more
than one record.

I included phscde in the SELECT clause, because to GROUP BY a column &
SUM() on each instance of that columns value w/o showing the column
value can be confusing. E.g.:

Include column value:

phscde Total
- --------- -----
1 25
2 30
3 1
4 5

When phscde is not shown the result is:

Total
- -----
25
30
  1
  5

Which can be meaningless when the associated column value (phscde) is
missing.

-- 
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQJF5joechKqOuFEgEQJdvgCaAkp/FG9M10MwXe82BR888/C4QHQAoKuC
tOWjfbgYaDt+UXHXSPERgNm5
=EFUe
-----END PGP SIGNATURE-----
B Nieds wrote:
> Hi:
> 
> Simple query really:
> 
> Select tbl1.phsmgr, (Select Sum(tbl1.phscst) as TCost from tbl1 Group by
> tbl1.phscde;) as Total from Tbl1;
> 
> Now I know I could use grouping in the above example but I wanted to show
> the simplicity which would cause the error. The above query will when run
> return the error "database engine could not lock table 'tbl1' because it is
> already in use by another person or process".  If I run the above query
> against an imported table then I get the error that only one record can be
> returned but at least it runs.
> 
> Normally tbl1 has a join to tbl2 which is joined to tbl3 which combine to
> provide the information that I want. I can circumvnent the problem by
> importing the data rather than linking but as I mentioned earlier the data
> is only as current as the import.
> 
> Thanks
> Bill
> "MGFoster" <me@privacy.com> wrote in message
> news:4qdkc.17579$e4.572@newsread2.news.pas.earthlink.net...
> 
>>Post your query's SQL statement.  Maybe something there we can analyze.
>>
>>--
>>MGFoster:::mgf00 <at> earthlink <decimal-point> net
>>Oakland, CA (USA)
>>
>>
>>B Nieds wrote:
>>
>>
>>>Hi:
>>>
>>>I am using Access to report on data maintained outside of Access. I have
>>>created links to the ourside files and have then created Queries, Forms,
> 
> and
> 
>>>Reports using these links. All of that is working reasonably ok.
>>>
>>>The problem I encounter is when I need to get more complex. Access will
> 
> then
> 
>>>complain that the linked table is in use (or opened exclusively) by
> 
> another
> 
>>>user. I tested with a copy of the files locally on my computer with the
> 
> same
> 
>>>results. Example is a subquery use the same table as the main query.
>>>
>>>Is this a limitation of linked tables? Is there a workaround or
> 
> alternative
> 
>>>method for getting the data? I know I can import the data but seems to
>>>defeat the purpose of linked tables.
>>
> 
> 


Relevant Pages

  • Re: how can I improve this querys performance
    ... is made 115000 times before the Group By on SubDivision is ... You should make this subquery after the Group By by putting your main SELECT ... > the following query that does exactly what I want, ... > FROM tbl1 AS T ...
    (microsoft.public.access.queries)
  • Re: Link table alternative
    ... import 4 - 12 tables each time the user wants to run a report or query. ... Query 2 SELECT Phsmgr, SUM, COUNT, AVGFROM tbl1 ... > SELECT phsmgr, phscde, SUMAs Total ...
    (microsoft.public.access.queries)
  • Re: Combine Tables
    ... Tbl1 is single field: ... Tbl2 has 2 fields: ... that determines where, the dash is. ... THEN use the query and tbl2 to create another query that joins ...
    (comp.databases.ms-access)
  • Re: Deleting Unmatched records
    ... I have created an unmatching query, using the wizard, on tbl2 with ... comparison to tbl1 to filter out which records in tbl1 no longer ... SQL View of query: ... PRIMARY KEY (Key1) ...
    (microsoft.public.access.queries)
  • Re: Find and Replace against set of rules in 2nd table
    ... is a table of instructions for updating each Record of TBL1? ... > be a query so that I can run it as needed. ...
    (comp.databases.ms-access)