473,811 Members | 2,859 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run a report using data in an open form

4 New Member
I have a report that runs based on parameters set in the underlying query. For example, in the "account number" field in the query I've entered [enter account number] in the criteria area. This allows the user to select a certain record. The record opens with all relevant data on a form. From the form, the user can then run specific reports about that record that also use the same [enter account number] criteria. I know there is a way to have access copy the account number from the open form and use it to run the report but I can't figure out the macro. Please help...
Aug 18 '09 #1
5 6552
ajalwaysus
266 Recognized Expert Contributor
You make this code the record source of the report and then execute the report from the form.

Expand|Select|Wrap|Line Numbers
  1. SELECT * 
  2. FROM Table1
  3. WHERE Table1.Field1 = Forms![FormName]!FieldName
-AJ
Aug 18 '09 #2
jgarcia187
4 New Member
Interesting. That works but then I lose all the other data fields that are shared between the table record and the report. Do I have to write the same code for every shared control on the report?
Aug 19 '09 #3
ajalwaysus
266 Recognized Expert Contributor
If I understand you, then you need to write code like this:

Expand|Select|Wrap|Line Numbers
  1. SELECT * 
  2. FROM Table1
  3. WHERE Table1.Field1 = Forms![FormName]!FieldName1
  4. AND Table1.Field2 = Forms![FormName]!FieldName2
  5. AND Table1.Field3 = Forms![FormName]!FieldName3
  6.  
Let me know if this is what you were after, otherwise please post a more specific explanation of what you need to do.

-AJ
Aug 19 '09 #4
jgarcia187
4 New Member
I’m using reports to build documents. My goal is to allow the user to only enter the record specific information once and then print all documents (separate reports) necessary. The user will enter a form and input the common field one time. That form will have all available documents on it as buttons. When the user presses a button, I need Access to use the data on the open form as criteria to open the report and display all data fields available in the record.

When I use the code you suggested, only the one field is selected, not the entire record.

For example. In the table let's say there are 24 fields. On the form, the user will enter data for one field "account number." Based on the report selected, Acess should use the account number field to go to the table and pull 12 fields of the 24 into the report.

I could make the report's record source a query where the criteria is [enter account number] but then the user has to enter the account number for every report they run...tedious.

I tried both ways you suggested but can't get it to pull in the entire record.

Clearly I’m not a professional…ju st a recreational user. Not sure if I’m explaining my problem correctly.
Aug 21 '09 #5
ajalwaysus
266 Recognized Expert Contributor
I don't think I still understand what the problem is. If you pass the ID of a desired record to your report, your report should be able to then run off that single ID and pull back all information in the table if you are using an SQL statement as you record source. If you have multiple reports that use that ID then it should be no different.

If possible, could you remove all sensitive data from your tables then upload the mdb in a zip file to this forum, perhaps going straight to the source would help me understand your issue.

-AJ
Aug 21 '09 #6

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

Similar topics

4
7066
by: deko | last post by:
I can't move a multi-page report to the last record unless I keep the popup form (that defined it's subreports) open. DoCmd.OpenReport "rptStandard", acViewNormal DoCmd.Close acForm, "frmReportOptions" <== popup form This is the error I get when I try to move to the last page of the report *after* closing the popup: "This expression is typed incorectly, or is too complex to be evaluate...."
1
2110
by: N. Graves | last post by:
Hi, I want to have a Search Dialog box that has several text box and fields to build a search and display the results in a form. I can do everything that I need to if I us a report but I would like to have the search from data displayed in a form. The structure that I have for this was take from the Asset Manger from MS. Anyway I open a report that in turn opens up a search form that allow me to select data. Then you continue by...
1
17686
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
2
5447
by: CSDunn | last post by:
Hello, I have an Access 2003 report that opens in print preview and then maximizes upon clicking a button from a form. The OnClick event of the button fires a macro to open the report. How can I use the NoData event of the report to present a message box ( with vbOkayOnly) so that when the button is clicked, if the report returns no data a message box appears, and the report never opens? I've tried the following in code with the...
6
3685
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as development of reports, it is certainly fine in my book. But for end-users, with little experience or training, it would be nice to have an easy way to handle various selection criteria, perhaps with relatively stock reports. I see easy to use by...
1
16394
by: lorirobn | last post by:
Hi, I have a report that works just fine. Now I would like to add the capability to choose selection criteria to limit what is displayed. I created several reports that do this, but they used VBA to create SQL statements, then apply them. Now that I have been using Access/VBA for awhile, I am wondering if there is a simpler way to do this than coding these long sql statements. My report has a query as its record source. Can I just...
6
12476
by: fieldja | last post by:
I have a form called OwnerForm. It contains a combo box called Owner. The combo box looks up names from a table called OwnerName. It contains fields called OwnerID and Owner. I also have a main form called ProjectsForm. This form has several fields to enter data. I have a query that is called Owner Query. This query contains the fields IDNumber.Projects2 Team.Projects2 and Owner.OwnerName getting information from tables. On the...
3
18722
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however, working with complex reports is tricky Assumption: Reader of this article have basic knowledge of creating data reports. Creating a Parent-Child Command and create a DataReport Suppose we have a database called company with two tables ...
3
3019
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
12
3546
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to print the report three times, but do not know how
0
9722
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10393
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
9200
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...
0
6882
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();...
1
4334
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
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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.