473,671 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open Filtered report from Hyperlink

2 New Member
I have got a report with a list of names and I want to make them hyperlinks, so that when clicked on they open another report in a window showing all the entries in the database filtered under their name.

I have tried using the DoCmd.OpenRepor t command and presently it just opens the report with a blank page.

Here is the code I have at the moment for the hyperlink:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Name_Click()
  2. DoCmd.OpenReport "Individual list", acViewPreview, , "[Name]= 'Me.Name'"
  3. End Sub
  4.  
I am sure it is just a silly error somewhere, but I cant seem to sort it!

Many thanks in advance.

Kieran
Jul 24 '13 #1
3 1369
zmbd
5,501 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. Private Sub Name_Click() 
  2. DoCmd.OpenReport "Individual list", acViewPreview, , "[Name]= '" & Me.Name &"'" 
  3. End Sub
Need to enclose the string portion of the criteria so that the form control value is available.

You've hit on two issues here:

Access 2007 reserved words and symbols
"Name" is one such reserved word and might cause you some issues.

Second:
You've stumbled upon one of my pet peeves by building the criteria string within the command - and it's not your fault because that's how a majority of examples show how to use the command.
Instead I suggest that you build the string first and then use the string in the command. Why you might ask, because you can then check how the string is actually resolving; thus, making troubleshooting the code so much easier as most of the time the issue is with something missing or not resolving properly/as expected within your string.

Expand|Select|Wrap|Line Numbers
  1. (some code omited...)
  2. DIM strSQL as string
  3. '
  4. strSQL = "[Name]= '" & Me.Name &"'" 
  5. '
  6. 'now you can insert a debug print here for troubleshooting
  7. ' - press <ctrl><g> to open the immediate window
  8. ' - you can now cut and paste this information for review!
  9. '
  10. debug.print "Your criteria = " & strSQL
  11. '
  12. 'now use the string in your code:
  13. DoCmd.OpenReport "Individual list", acViewPreview, , strSQL
Jul 24 '13 #2
barter27293
2 New Member
Thanks for that - it was just the reserved word 'Name' that was causing the issue... sorry I'm not that experienced with access - just trying to pick it up as I go along!

thanks again :-)
Jul 25 '13 #3
zmbd
5,501 Recognized Expert Moderator Expert
Those nasty little keywords are a Gremlin for many people. The other is using spaces. Although technically allowed under the newer programs and operating systems, you'll find that if you need to upgrade to a larger database (SQLServer, MySQL, Oracle, etc...) that the spaces may also cause issues.


My Pleasure. We were all at the bottom of the learning curve at some point! Please keep us in mind should you get stuck again.
Jul 25 '13 #4

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

Similar topics

6
6219
by: dog | last post by:
Does anyone know how to use a hyperlink in MS Access (I'm using 97) to open a report or form within the same database? I have a form in my database, I have put a label on it, some text, and when the user clicks on it I want it to open one of the reports. It's easy enough to use the 'On Click' Event procedure to open another object, however when the user puts the mouse pointer over the label I would like the 'hand' to appear, as it does...
1
2071
by: Gerry Abbott | last post by:
Hi all, The following code works to output a report myReport, to a file myFile, in ..snp format. --------- DoCmd.OutputTo acOutputReport, "MyReport", "Snapshot Format", MyFile ---------
6
1726
by: erick-flores | last post by:
Hello, I want to make a report for a single compressor. Instead of showing a report for all the compressors. I would like to place a button in the compressor form, so whenever I want to display a report from that particular compressor I click the button and the report will show ONLY that compressor. Each compressor has it own primary key. So i guess I need to match that pk with my report. Can somebody give me some ideas ? I am pretty...
2
2480
by: Bob | last post by:
I have a regular C# form with a button on it. I want to click the button and open the report. What code do I need to open the report? Thanks-in-advance. Bob
3
1611
by: samanta | last post by:
Hi all, I am using the following code to open a report from a datagrid. <asp:TemplateColumn HeaderText="Company Name"> <HeaderStyle Font-Size="Larger" Font-Bold="True"Width="25%"></HeaderStyle> <ItemStyle Font-Bold="True" HorizontalAlign="Left"></ItemStyle> <ItemTemplate> <%# Databinder.Eval(Container.Dataitem,"PotentialID","<A href=""?ID=LTSReport&PotentialID={0}"">" & Databinder.Eval(Container.Dataitem,"CompanyName") & "</a>") %>...
0
1568
by: Kelii | last post by:
Evenlater, Yeah, I don't open the report in preview mode when I setup my recordsource, filters, or sorts. Before I give my solution, I would say that your code will be simpler if you drop the "Sort" button and simply include the sorts in the primary window rather than a window in dialog mode. For example, I use 5 sorts in my preview screen, the first sort is always enabled, the second sort only becomes enabled if the first is not null...
3
2072
by: Naushad | last post by:
Hi All, I am trying to open the report conditionally from the dialogue box form. In the form there are three field. cboEmployees StartDate EndDate I have used these field in criteria to open the report. If I use the
0
1184
by: sarvmardan | last post by:
how to open a report in access containing filtered data using two combo boxes on form and a button to click. let i have two fields and other is . two comboboxes are combo11 and combo9. plz post the codes so that i can open my report with filtered data in access 2007.
6
1988
by: SusanK4305 | last post by:
Here are my two code for the Report that will be opened. This Report is in Access and is name rpt1, It isn't opening like it should. Please Help... Thank you. Private Sub cmdApplyFilter_Click() Dim varItem As Variant Dim strAction_Types_Choices As String Dim strReason_Choices As String Dim strPosition As String Dim strFilter As String Dim StrSortOder As String
0
1319
by: Jason Hamilton | last post by:
Hey all, Okay, so here's what's going on. I have a customer who wants me to push the reports generated by MS Access to his corporate website on demand. I have most of this problem solved (by using the Microsoft.Office.Interop.Access library from inside a WCF Server and connecting to the server in an ASPX web application). There is one last piece that I can't figure out and I think I can solve it all from inside MS Access with a (small?)...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8676
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6237
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.