Solved view attachments from many tables (1 Viewer)

nicolareina

New member
Local time
Today, 09:07
Joined
Apr 21, 2021
Messages
23
Good Morning i have a problem :(


I have two tables in my database,Tbl_A and Tbl_BI'd like to view the attachments, but I can't. Is there a way? And then in the subject list form, I can click the "view all attachments from all tables - current month" button. It should extract the data from both tables into a datasheet form.Thanks, I'm going crazy.

extract on c:\
 

Attachments

You are storing the filepaths, so why can't you store them in the actual tables?, otherwise you would need to link to them with a join and use a query as form source.
I would also only have one table with a field that determines A or B (and any others that might bee needed in the future)
 
You are storing the filepaths, so why can't you store them in the actual tables?, otherwise you would need to link to them with a join and use a query as form source.
I would also only have one table with a field that determines A or B (and any others that might bee needed in the future)

HOW DO I MAKE A JOIN QUERY? I'M NOT AN SQL EXPERT.
THANKS GASMAN :)
 
You are storing the filepaths, so why can't you store them in the actual tables?, otherwise you would need to link to them with a join and use a query as form source.
I would also only have one table with a field that determines A or B (and any others that might bee needed in the future)
THE PROBLEM IS THAT EACH EMPLOYEE HAS ABOUT 100 FILES SO I DON'T WANT TO WEIGHTEN THE MAIN TABLE "TBL_a" OR "TBL_B"
 

Attachments

  • screen.jpg
    screen.jpg
    341.8 KB · Views: 9
OK, in that case you have your table of filepaths, and link to them with the PK of the table as a FK in the filepath table.
To create a join.
I would probably have a subform for all the filepaths.

I have not played too much with filepaths and objects in Access. Last time I tried to help someone with linked path, I failed miserably. :(
 
not sure what you want but just in case try.
 

Attachments

not sure what you want but just in case try.
The solution is perfect, thank you very much. I wanted to ask you: by clicking the attach button, is it possible to view the list of datasheet attachments for each individual employee?
 

Attachments

  • screen2.jpg
    screen2.jpg
    118.6 KB · Views: 8
In the "DETTAGLIO SOTTOPOSTO" submitted, by clicking on the attachment button, it shows me the attachments of all the employees, but without the filepath I can't understand where the error is.
 

Attachments

You are using the table and not the query. No filepaths are in the A or B Table. :(

Learn to walk your code with F8 and inspect variable/control values.
 
You are using the table and not the query. No filepaths are in the A or B Table. :(

Learn to walk your code with F8 and inspect variable/control values.
Sorry, Gasman, I'm unfortunately ignorant on the subject, but would you be so kind as to access the project and fix it? That way I can get some ideas. Thanks.
 
Well I think your whole approach is wrong, and I do not even know what you are trying to attempt?
I hardcoded the form recordsource to make sure I was correct.
 

Attachments

Well I think your whole approach is wrong, and I do not even know what you are trying to attempt?
I hardcoded the form recordsource to make sure I was correct.

Thanks for your precious help, but it wasn't what I wanted. See attached image.
 

Attachments

  • aaa.jpg
    aaa.jpg
    54.1 KB · Views: 11
That is because you are not using any WHERE condition? :(
I do not use macroes, so changed it to VBA.

However you have to get your ducks in a row. No point using a WHERE parameter and then changing the recordsource on form load. :(
That will wipe out the WHERE argument.

I would sit back, take a deep breath, and work out logically what you are trying to do, rather than just chuck code in and hope it works. You will be there forever otherwise.
It does not help me either, as Italian is alien to me. :(
 

Attachments

That is because you are not using any WHERE condition? :(
I do not use macroes, so changed it to VBA.

However you have to get your ducks in a row. No point using a WHERE parameter and then changing the recordsource on form load. :(
That will wipe out the WHERE argument.

I would sit back, take a deep breath, and work out logically what you are trying to do, rather than just chuck code in and hope it works. You will be there forever otherwise.
It does not help me either, as Italian is alien to me. :(
clicking the attachemnt button opens the form but with another employee :)
 

Attachments

  • screen4.jpg
    screen4.jpg
    150 KB · Views: 9
I just matched to ID. You need to decide what you want to match on.
If you go to the second record, you will see the correct one. Just that it is in a different table.? :(

So you need to use table name in the criteria as well, if you are going to stick to this non normalised db. :(
As I said. Sit back and *think* on what you want to do.

Us correcting your DB for you all the time, means you learn nothing. This example is proof of that? :(
 
Having looked at the sample provided, it's clear that the problem is more complex than displaying related attachments. It's likely that the sample provided is actually not the same as the real tables in the working database either. "Tbl_A" and "Tbl_B" appear to be pseudo tables created only for this uploaded sample. However, if they are based on the same design approach as your actual tables, they are fundamentally incorrectly set up.

The tables are identical in structure, only differing in the names included. There should be ONE table, not two. And whatever the difference is between the data in the two tables (perhaps they represent different police categories, as suggested in the images in tblImagesRibbons. Perhaps "A" is for one of the forces, and "B" for another. Perhaps there is still some other, undisclosed categorization.

Ultimately, improper table designs like this lead to all manner of complications downstream as you try to manage the data.

You need two tables, not four.

TblEmployee-- which I think is what appears to be the entity involved because it has Nome and Cognome fields. In addition to those two fields, you need a field to indicate which of the two other attributes applies, "A" or "B", whatever that designates.



The attachment table is the same as it is now, but combined because it only needs to support the one employee table.

That also allows you to replace the qry_union, which is further indication that "A" and "B" contain the same data, and should be combined with an additional field to indicate that status.
I've done a lot of the prep work to implement this, more appropriate design, along with resolving the problem of filtering attachments by person.

I did some guesswork about the actual content of the database, but you'll need to sort out the appropriate names.

NOTE: I corrected an oversight in the sample I uploaded. This version is more appropriate.

Also, I didn't delete the now obsolete objects and code. I only focused on the table/query/form changes required to more properly model the data.
 

Attachments

Last edited:
Having looked at the sample provided, it's clear that the problem is more complex than displaying related attachments. It's likely that the sample provided is actually not the same as the real tables in the working database either. "Tbl_A" and "Tbl_B" appear to be pseudo tables created only for this uploaded sample. However, if they are based on the same design approach as your actual tables, they are fundamentally incorrectly set up.

The tables are identical in structure, only differing in the names included. There should be ONE table, not two. And whatever the difference is between the data in the two tables (perhaps they represent different police categories, as suggested in the images in tblImagesRibbons. Perhaps "A" is for one of the forces, and "B" for another. Perhaps there is still some other, undisclosed categorization.

Ultimately, improper table designs like this lead to all manner of complications downstream as you try to manage the data.

You need two tables, not four.

TblEmployee-- which I think is what appears to be the entity involved because it has Nome and Cognome fields. In addition to those two fields, you need a field to indicate which of the two other attributes applies, "A" or "B", whatever that designates.



The attachment table is the same as it is now, but combined because it only needs to support the one employee table.

That also allows you to replace the qry_union, which is further indication that "A" and "B" contain the same data, and should be combined with an additional field to indicate that status.
I've done a lot of the prep work to implement this, more appropriate design, along with resolving the problem of filtering attachments by person.

I did some guesswork about the actual content of the database, but you'll need to sort out the appropriate names.

NOTE: I corrected an oversight in the sample I uploaded. This version is more appropriate.

Also, I didn't delete the now obsolete objects and code. I only focused on the table/query/form changes required to more properly model the data.
It was exactly what I was looking for. You guys are amazing. Thanks. I solved it.
thanks

GPGeorge,

arnelgp
 
I just matched to ID. You need to decide what you want to match on.
If you go to the second record, you will see the correct one. Just that it is in a different table.? :(

So you need to use table name in the criteria as well, if you are going to stick to this non normalised db. :(
As I said. Sit back and *think* on what you want to do.

Us correcting your DB for you all the time, means you learn nothing. This example is proof of that? :(
thanks gasman :)
 

Users who are viewing this thread

Back
Top Bottom