473,320 Members | 1,921 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,320 software developers and data experts.

How do I link back to a record from a reports results?

Microblitz
This is the senario;

I have a database which creates a report of batch numbers occuring on a specific day.

The form is linked to a report which returns the days on which a particular batch number occurs.

I want to be able to click on a date in the report and filter the form according to the report.
I have already created a clickable link (Hyperlink) in the report which is the date I want to link back to the main form as the filter.

The code I currently have uses the following variables.

[DateofTest] is the column in the record table
Main is the form name
DateOfTest is the created day that a searched for batch number occurs on in the report.

Expand|Select|Wrap|Line Numbers
  1. Private Sub DateOfTest_Click()
  2. DoCmd.OpenForm "Main", acNormal, , [DateOfTest] = Me.DateOfTest
  3. End Sub
  4.  
There are lots of examples of this code around but all deal with numbers or strings not datecodes, so Ive already been through the "Type mismatch" routine. This code doesnt freak but equally does'nt filter. The filter button is lit in the form "Main" but it displays all records.

Where did I go wrong?
Jul 19 '10 #1

✓ answered by NeoPa

Strange but True! eh.

Your problem may be associated with your use of the date literal then. See Literal DateTimes and Their Delimiters (#).
Expand|Select|Wrap|Line Numbers
  1. Private Sub DateOfTest_Click()
  2. DoCmd.OpenForm "Main", acNormal, , "[DateOfTest]=" & Format(Me.DateOfTest, "\#m/d/yyyy\#")
  3. End Sub

5 1614
NeoPa
32,556 Expert Mod 16PB
I'm using Access 2003 and I don't see an option to handle a Click event on a TextBox control within a report. Is this possibly a new feature?
Jul 19 '10 #2
I'm using 2007 and there is a link to URL feature(It looks like this http://bytes.com/images/editor/createlink.gif ).Insert+K adds it on a control selected from the design menu. You then have an option to use the wizard or create your own event for it.
Jul 19 '10 #3
missinglinq
3,532 Expert 2GB
Yes, NeoPa, they added all kinds of nonsensical stuff to Reports in v2007, even Command Buttons!

Makes absolutely no sense to me!

Linq ;0)>
Jul 19 '10 #4
NeoPa
32,556 Expert Mod 16PB
Strange but True! eh.

Your problem may be associated with your use of the date literal then. See Literal DateTimes and Their Delimiters (#).
Expand|Select|Wrap|Line Numbers
  1. Private Sub DateOfTest_Click()
  2. DoCmd.OpenForm "Main", acNormal, , "[DateOfTest]=" & Format(Me.DateOfTest, "\#m/d/yyyy\#")
  3. End Sub
Jul 19 '10 #5
Good news everybody!(I admit to being a Futurama fan!)
That works fine now.

And I guess the reason some of the advanced controls are available to reports are that some people never print out a report anymore, they use it as a dashboard and want to tinker with the variables.
Jul 20 '10 #6

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

Similar topics

2
by: rob | last post by:
I'm having some trouble with this.. My VB datareader seems to skip the first record in the reader. I've looked at my query in enterprise manager to confirm what I am suppose to receive back,...
1
by: Buttercup | last post by:
I have written a generic script in asp to add records to a table. The script works fine with one table but in the other tables it updates the first record in the table with the values for the new...
0
by: Tim | last post by:
I have a search page that return a datagrid and when the user click an item to edit takes the user to the update page. After the user updated the information, I like to have a button/hyperlink to...
3
by: TrvlOrm | last post by:
I am having great difficulty in these asp scripts, using VBscript and JavaScript. I have 4 files that all need to be linked together. The first file "Books.html" - needs to search for a Book...
1
by: Jack-of-all-traits | last post by:
This is a big problem and I really need help, no one seems to know how to solve this problem. I want to take the data from a record in a particular a field that contains the names of generic...
1
by: sqlster | last post by:
I have a search page which renders results upon post back based on certain input criteria. Clicking on a link on a search result such as order number navigates to the order detail screen. What...
4
by: bendlam | last post by:
I have a page that contains search criteria and when you click on the search button it causes a post back that populates a dataview on the same page. One of the gridview columns contains a link...
10
by: Lloyd Harold | last post by:
I'm very new to PHP and attempting to put together a simple script for retrieving MySQL data of personal records. The MySQL table I'm using consists of: 0: id 1: name 2: location (an integer...
1
by: steen.bray | last post by:
Hello, I'm having an extremely weird problem with Crystal Reports and .NET 2005. The process: I have created a report launching aspx page that allows a user to select one of 8 reports, fill...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.