Link to reports on query reults

setis

Registered User.
Local time
Yesterday, 22:35
Joined
Sep 30, 2017
Messages
127
Hi all,

Is it possible to generate a link to a report (associated to the respective ID) on query results?
 
I'm not sure I understand your question. Can you give an example?
You can filter a report on opening using a filter or where condition.
 
I'm not sure I understand your question. Can you give an example?
You can filter a report on opening using a filter or where condition.

Sorry.

I have a case registration table and from the registration form, I can produce a report for each case (basically an invoice).

I have a split form to search on all the cases using a query that I did for this purpose. I would like to include in this query (if possible) a link to each report (invoice). Does it make sense?
 
Do you want to link to a stored pdf of the invoice or just recreate the report on screen ?

If it's the latter, the you could easily add a open report preview on the double click event of the record ID or similar. However be warned that Split forms behave rather oddly, so you may need to recreate the look of a split form with a sub form as a datasheet rather than the split form.
 
Do you want to link to a stored pdf of the invoice or just recreate the report on screen ?

If it's the latter, the you could easily add a open report preview on the double click event of the record ID or similar. However be warned that Split forms behave rather oddly, so you may need to recreate the look of a split form with a sub form as a datasheet rather than the split form.

I just need a link to the report and one for the form if this is possible. I just want to be able from the query results to open the form or the actual report.
 
In the form create a command button that opens the report filtered to the current record - something like;

Code:
DoCmd.OpenReport "YourReportName" , acViewPreview , , "YourUniqueID = " & Me.YourUniqueIDControlName
 
In the form create a command button that opens the report filtered to the current record - something like;

Code:
DoCmd.OpenReport "YourReportName" , acViewPreview , , "YourUniqueID = " & Me.YourUniqueIDControlName

Apologies, I think that I didn't explain myself properly.

I need a link for the reports on the query results. I have already a button on every form to show the report. I would like to access to if from the query.

If I look for case 234, I don't want to go to the form and look for the ID 234. I would like to open the report from the actual query. Is it possible to create hyperlinks on the ID's in the query to the reports?
 
Yes - so back to my first question - are these stored copies of the reports, pdf's stored on your network?

If they are and the reports are stored in the format YourUniqueID.pdf then it's simple to create a clickable link to the location in the query;

Code:
MyLink: "\\Server\YourStoragepath\" & [UniqueID] & ".pdf"

If you set the type to hyperlink I believe it will open the file.
 
Yes - so back to my first question - are these stored copies of the reports, pdf's stored on your network?

If they are and the reports are stored in the format YourUniqueID.pdf then it's simple to create a clickable link to the location in the query;

Code:
MyLink: "\\Server\YourStoragepath\" & [UniqueID] & ".pdf"
If you set the type to hyperlink I believe it will open the file.

Well I could refer to the PDFs stored in the network but wouldn't it be easier just to produce a new report based on the ID on the actual row?

What if I want to open the form on the record given by the ID on that road? I can do that with a Macro, right?
 
Yes - that's what I suggested in the previous post.

Maybe you could make a picture of what you are trying to achieve as something is being lost in translation between us here?
 
Something like this. This is a database example from Microsoft... clicking on the quote "1006", "1007" will open that particular form. I can see that it is done with a macro
 

Attachments

  • ex.PNG
    ex.PNG
    23 KB · Views: 88
You can do that in the on Click or Double click event of that control. (Click can be troublesome if the user simply wants to select the record first)

That's pretty much what I was suggesting in the post #4. Just be aware that on a split form there are some issues.
 
I have already a button on every form to show the report. I would like to access to if from the query.
You say you want to open the invoice from the "query" but that is NOT possible. Queries do not offer events so there is no place where you can insert your code. Not to mention - users should NEVER, EVER, under ANY CONDITION be able to open a raw query. Users should always interact with the data via forms and reports where you have events that can be used to control what he does and perform validation.

If you are referring to the list view rendition of a form which can look like a query, that's different. The others have already told you how to open forms and documents from a form. You use the DoCmd.OpenReport to open a report, DoCmd.OpenForm to open a form and Follow Hyperlink (which no one has mentioned) to open a document or a web page. There is no need to use the hyperlink data type.

Application.FollowHyperlink strInput, , True

strInput must contain the full path to a document or web page. For documents, as long as Windows has a file association for the extension so it knows what app to open, this will work for .xlsx, .docx, .pdf, .jpg, and anything else known to Windows.
 
Thank you very much for your comprehensive answer, Pat.
 

Users who are viewing this thread

Back
Top Bottom