473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Hyperlink a report to another report

I have two report reports. One report displays a field called [BWAID]. The second report is a report for a single record in mor detail. I am trying to convert this textbox on my first report into a hyperlink. The hyperlink will link to the 2nd report report. I need this hyperlink to also capture what the [BWAID] is when clicked and use the [BWAID] in a paramater query to pull up another report (more detailed report).

I am looking for advice on how to approach this situation. I looks to me that I should program an OnClick VBA however I don't understand how to pull the [BWAID] value into my second report parameter query.

Thanks
Nov 30 '11 #1

✓ answered by Mihail

Sorry wisni1rr.
Now I see your mistake.

I say (see post #5) that lngBWAID must be a PUBLIC variable. Maybe you misunderstood because my English.

So, make only this change:

Expand|Select|Wrap|Line Numbers
  1. Public lngBWAID As Long
Now should be work

11 5105
Stewart Ross
2,545 Expert Mod 2GB
Reports are not interactive. There is no on-click event you can use on a report, nor can you click on a hyperlink to link from one to another. Perhaps if you explained what it is you are trying to achieve we could suggest some alternative approaches for you.

-Stewart
Nov 30 '11 #2
Basically I have a Report. The report will contain multiple records. One of the text display fields has an Id number [BWAID]. My user wants to click on the [BWAID] text box and have it open a second report which is a detailed listing of a single record.

I can set an [OnClick] Event on the report with multiple records on the [BWAID] textbox control and program the event to open another report (Detailed report). I need to pull the value out of the [BWAID] Textbox and use that as a parameter to open up my detailed report.

Hope that Helps. I can upload pics if your still not sure what I'm trying to do.

Thanks
Nov 30 '11 #3
NeoPa
32,556 Expert Mod 16PB
Stewart, I believe Access versions 2007 and beyond actually do have interactive reports now.

I suspect it was to pander to those who couldn't work out how to use the thing properly in the first place, but I hear (No direct experience, you understand) that this is one of the changes introduced then.
Nov 30 '11 #4
Mihail
759 512MB
Hi.
Indeed, in 2007 reports are interactive.

wisni1rr, try that:
Create a module (will be a global module) or use an existing one
In this module dim a PUBLIC variable (say lngBWAID As Long) and design also a PUBLIC function (say RetBWAID)
Expand|Select|Wrap|Line Numbers
  1. Public Function RetBWAID as Long
  2.     RetBWAID = lngBWAID
  3. End Function
Under click event of the main report control (the text box in your case) set the value for the public variable
Expand|Select|Wrap|Line Numbers
  1. lngBWAID=YourTextBox.Text
  2. 'Place here the code to open the second report

Assuming that your second report is based to a query, switch to this query design view and, in criteria row (for BWAID field, of course) write RetBWAID()
DO NOT omit parenthesis !!!

That should be all.
Save and test.

I don't try this so sorry if I misspelled something. Compile the code before running

Good luck !
Dec 1 '11 #5
Close Mihail but I haven't got it quite yet.

I'm sure it is something I am doing wrong. Here is where I am at.

I have created a module called basBWAret:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Dim lngBWAID As Long
  3. Public Function RetBWAID() As Long
  4.     RetBWAID = lngBWAID
  5. End Function
On the BreakdownReport the Click Subroutine is for my textbox named BWA_ID:

Expand|Select|Wrap|Line Numbers
  1.  lngBWAID = BWA_ID.Text
  2.     DoCmd.OpenReport "ListingReport", acViewPreview, , , acNormal
  3.  
On the query that is used as the RecordSource on my ListingReport I have entered this as the criteria under the BWA_ID field:

Expand|Select|Wrap|Line Numbers
  1. RetBWAID()
As it is the first report opens and you can click on the BWA_ID textbox control. It opens the appropriate report (ListingReport. However, the report textbox conrtols are blank.

Any advice?
Dec 1 '11 #6
Mihail
759 512MB
Let's try to debug that.
Insert to more lines in your code (under click event)
Expand|Select|Wrap|Line Numbers
  1. Private sub BWA_ID_Click
  2.     lngBWAID = BWA_ID.Text
  3.         Stop
  4. Exit sub
  5.     DoCmd.OpenReport "ListingReport", acViewPreview, , , acNormal
  6. End sub
Run the code as usually.
When the code stop (to Stop statement) verify the value for lngBWAID . Is it what you expected ?
(To verify the value place the mouse cursor over the lngBWAID. Or press CTRL+G. This will open the Immediate window. Type ?lngBWAID and press enter.)

If YES (it is the expected value) then press F5 to continue.

At this point run the query itself.
Do it the job as you expect ?

Let me know the answers to this questions.
Dec 1 '11 #7
NeoPa
32,556 Expert Mod 16PB
I would advise checking through When Posting (VBA or SQL) Code before proceeding with your code development. It may well save you wasting a lot of your time.
Dec 1 '11 #8
The lngBWAId variable is collecting the appropriate value.

When the VBA hits STOP I try to run the query itself

The query is attached to the Report "ListingReport"

When trying to run it displays an error of "unknown Access database engine error"
Dec 1 '11 #9
Mihail
759 512MB
Sorry wisni1rr.
Now I see your mistake.

I say (see post #5) that lngBWAID must be a PUBLIC variable. Maybe you misunderstood because my English.

So, make only this change:

Expand|Select|Wrap|Line Numbers
  1. Public lngBWAID As Long
Now should be work
Dec 1 '11 #10
Works perfectly now!!! Thanks a lot!
Dec 1 '11 #11
Mihail
759 512MB
More one thing:
Set Option Explicit for your VBA editor.
For that, in VBA editor, go to Tools - Options and check "Require Variable Declaration".

This option will affect only new modules.
For the oldest modules write, at module top, Option Explicit.

This will save you a lot of time when debug an application.
Dec 1 '11 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Len Coleson | last post by:
I am at wits end with this. I have a transaction report that has a union query as a record source that asks date parameters from an input form. The sub report is based on a variation of the same...
2
by: Bill | last post by:
I'm having trouble making hyperlink fields or controls or labels to be active in a report. The hyperlink field is fine in the Table and in the Query but not in the Report based on the query. I...
0
by: John Bailey | last post by:
Okay, I can display local reports just fine on my web server, but when I put my site on Crystal Tech I am getting the error: The definition of the report 'Main Report' is invalid. I do not...
1
by: Sean Chiu | last post by:
Hi all, I have a problem on crystal report xml report service. After I finished a simple report service and tested it in local IIS, it works. However, when publishing it to a production IIS...
1
by: gregoryenelson | last post by:
Hi all. I have created a Report with a graph also on it. The users, working through a form only (not the DB window) will want to view that Report run numbers of times against different criteria,...
2
by: airdata | last post by:
Hi I currently have the following code attached to a command button on a switchboard form. This is basic Access 2000. Private Sub Print_daily_reports_button_Click() On Error GoTo NoData...
0
by: kishorebarik26 | last post by:
Dear reader, I need a way by which I can call one report from another report in Crystal Report or in Rdlc Report in VB.net 2005. Two report will not interlinked any way, so I cannot use Subreport...
4
by: tatipellinaresh | last post by:
Hi, I am using Oracle Reports builder for reports. I have one pie graph in my report. It contains 3 fields like lastmonth, lastweek, today. what I want to do is, when I click on a field it should...
0
by: empk | last post by:
I have a mysql table result displayed in 3 columns viz., "name", "amount" and "days" in a page, mainly a summary page. The contents of the first column "name" is displayed as a hyperlink which when...
1
by: Leah Beard | last post by:
I have a table with a stored hyperlink field and in the report from the table i want view the hyperlink, so i need to write a event procedure to open the hyperlink when a text box is clicked in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.