473,699 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to select one record for a query of report

13 New Member
Thread #1 Post #1:

Curretnly I have made a table to store data. I use a query to do some calculations on the data. I have a form that opens the query for me to reveiw the data. The form also opens up a report. However the query, form, and report currently bring up all records. I would like to be able to select one record to veiw and then report. Can you help?

Thanks

Thread #2 Post #1:

I currently have a database in access and i have a table for data, a query to calculate the data, a form for that query to display the results, and to send to a report. However when I open the query form it includes all records, as does the report. I would like to select one record for veiwing and reporting at a time. Can you help?

---

[Z: Moderator's comments:{blpie rce76 - I've merged your two threads and the comments. In the future, please do not double post your question(s), nor bump the thread(s).
Please keep in mind that moderators, experts, and others are un-paid volunteers that attempt to provide some help and guidance in-between our obligations to work and family. Please be patient – especially on holidays and busy posting days.
Both threads can be deleted by accident if one Moderator deletes one thread and and a different Moderator deletes the other... it has happend... and there's the 411}]
Jan 8 '14 #1
9 1773
zmbd
5,501 Recognized Expert Moderator Expert
Certainly we can help.
Yes it can be done.
Hopefully you have a primarykey, simply restrict the recordset so that the constraint is [primary key]=desired record's primary key
Of course, changing the name and value to match what you have. (^_^)

If you don't have a primary key then you'll need field data that is unique to the desired record.

If you will provide some more detail, such as the SQL for the query, which verson of Access, Operating sytem, etc... we can be of much more help.

Also, we'll need to see any other work you've attempted, this is a common homework question.

Please remember to format SQL-Script using the [CODE/] button in the toolbar.
Jan 8 '14 #2
morganaj
12 New Member
When you build your query, you have to either build in parameters (criteria section) to filter the query that feeds to the report.

Alternatively in the criteria sections you can enclose a string in square brackets, for example:

[Enter What you are hoping to filter]

This will bring a modal pop-up to have the user enter the criteria to filter on. I hope this makes sense. Let me know if you have any more issues.
Jan 8 '14 #3
blpierce76
13 New Member
Heres what I have on the query.
It pulls data from my table and calculates new data.
All of this data is then sent to a report.
I would like to be able to retrieve it by one record at a time based on "Lab ID" which is the primary key.

Expand|Select|Wrap|Line Numbers
  1. SELECT Data.[Lab ID #]
  2.    , Data.[ADL Pan Weight]
  3.    , Data.[ADL Pan & Sample Wt]
  4.    , Data.[ADL Pan & Dry Sample Wt]
  5.    , Data.[Residual Moisture]
  6.    , Data.[Ash, Dry]
  7.    , Data.[Volatile, Dry]
  8.    , Data.[Sulfur, As Determined]
  9.    , Data.[BTU, As Determined]
  10.    , ([ADL Pan & Sample Wt]-[ADL Pan & Dry Sample Wt])/([ADL Pan & Sample Wt]-[ADL Pan Weight])*100 
  11.       AS ADL
  12.    , (1-[ADL]/100)*[Residual Moisture]+[ADL] AS Moisture, (1-[Moisture]/100)*[Ash, Dry] AS [Ash AR], (1-[Moisture]/100)*[Volatile, Dry] 
  13.       AS [Volatile AR]
  14.    , [BTU, As Determined]/(1-[Residual Moisture]/100) 
  15.       AS [BTU Dry]
  16.    , (1-[Moisture]/100)*[BTU Dry] 
  17.       AS [BTU AR]
  18.    , [BTU Dry]/(1-[Ash, Dry]/100) 
  19.       AS [MAF BTU]
  20.    , 100-([Ash, Dry]+[Volatile, Dry]) 
  21.       AS [Fixed Carbon Dry]
  22.    , 100-([Moisture]+[Ash AR]+[Volatile AR]) 
  23.       AS [Fixed Carbon AR]
  24.    , Data.Customer
  25.    , Data.[Sample Identification]
  26.    , Data.[Date Sampled]
  27.    , Data.[Date Received]
  28.    , Data.Description, Data.[Sample Wt]
  29.    , [Sulfur, As Determined]/(1-([Residual Moisture]/100)) 
  30.       AS [Sulfur, Dry]
  31.    , [Sulfur, Dry]*(1-([Moisture]/100)) 
  32.       AS [Sulfur, As Received]
  33.    , Customers.CompanyName
  34.    , Customers.BillingAddress
  35.    , Customers.City
  36.    , Customers.State
  37.    , Customers.PostalCode
  38.    , Customers.Department
  39. FROM Customers 
  40.    INNER JOIN Data 
  41.       ON Customers.CustomerID 
  42.          = Data.Customer;
Jan 8 '14 #4
blpierce76
13 New Member
Also its Access 2007 on windows XP
Jan 8 '14 #5
pegicity
8 New Member
You need to add a WHERE clause to your query, the sytanx would be as follows:

Expand|Select|Wrap|Line Numbers
  1. SELECT (fields you want to select)
  2. FROM (source table)
  3. INNER JOIN ON (the other table you are joining with)
  4. WHERE (desired field) = (desired value for the field)
  5.  
Jan 8 '14 #6
zmbd
5,501 Recognized Expert Moderator Expert
First of all, get rid of all of your hash-tag "#", commas ",", and all other non-alphanumeric characters from your field names... re-write what you have to; however, the sooner you do this the better!
Read why at these two links:
Access 2007 reserved words and symbols
AllenBrowne- Problem names and reserved words in Access

The form also opens up a report.
So let's see the code that you are using to call the report.
Several ways to filter down the records in the report, from the form, the calling VBA, from the report as we might simply pass the form's "current record" primary key to the report's filter, etc...

>PLEASE< Remember to format your script using the [CODE/] format button. Selecting your VBA (or other scipt) and then clicking on the [CODE/] format button will place the required [code] [/code] tags around your script.
Jan 8 '14 #7
zmbd
5,501 Recognized Expert Moderator Expert
pegicity & morganaj:
You have the correct idea; we may also use the form's current record to allow OP to select the record in the open form and pass that as a filter to the report; thus, no need to change the SQL which may prove advantagous if it is used in other aspects of the database.
Jan 8 '14 #8
blpierce76
13 New Member
OK here what I have for the report. Currently I have a form based on the query that allows me to search for the record I want based on lab ID# and dispays it on the form. Then I have a command button to bring it up on a report that I formatted. It works pretty much like I want it to except that it generates a report for each record.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
  2.  
  3. Exit_Find_Record_Click:
  4.     Exit Sub
  5.  
  6. Err_Find_Record_Click:
  7.     MsgBox Err.Description
  8.     Resume Exit_Find_Record_Click
  9.  
  10. End Sub
  11. Private Sub Command45_Click()
  12. On Error GoTo Err_Command45_Click
  13.  
  14.     Dim stDocName As String
  15.  
  16.     stDocName = "Prox Report"
  17.     DoCmd.OpenReport stDocName, acPreview
  18.  
  19. Exit_Command45_Click:
  20.     Exit Sub
  21.  
  22. Err_Command45_Click:
  23.     MsgBox Err.Description
  24.     Resume Exit_Command45_Click
  25.  
  26. End Sub
  27.  
Jan 8 '14 #9
blpierce76
13 New Member
morganaj

I tried bracketing the Lab ID in the criteria for the query and it works well, except that I have to enter the lab # when I open the form and when I click to open the report. Is there any way around having to do that twice?

zmbd,

Thanks for the tip on getting rid of non alphanumerics. This is my first attempt with Access and have done everything up to this point by just reading and learning, so I appreciate the help.
Jan 8 '14 #10

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

Similar topics

3
354
by: | last post by:
Is a SELECT TOP query allowed in filtering rows from a datatable? If it is not, is there any other easy way to filter a given number of rows from a datatable? Thanks a lot for your help.
1
1951
by: allie357 | last post by:
I am trying to add a form with a combo box to an existing parameter query report. I followed the directions from this link:http://office.microsoft.com/en-us/assistance/HA011170771033.aspx However, even though the form pops up when I click on the report, the combo box is not populating and the report still has popping up parameters, even though I thought I removed them. Any help is appreciated.
3
3085
lwwhite
by: lwwhite | last post by:
I've got a a datasheet subform that gets its data from a SELECT DISTINCT query. The data is not editable. When I remove the DISTINCT qualifier from the query, the data is editable, but of course I get a much longer record set. I understand why Access doesn't want to let the data be editable in this situation, but I'm hoping there is a way to circumvent this restriction. Thanks for any suggestions. (Access 2003)
3
5837
by: sfjnet | last post by:
Hi I am relatively new to Access so I hope I am not embarrassing myself with this question. I have created a database showing contract details (contract number, contractors, dates, other relavant info). Also on the data entry form there is a separate field for each month of the financial year and the user can enter a value in the relevant month(s) corresponding to the number of hours the contractor has worked that month. The users...
2
2554
by: Shivajirp | last post by:
I have table in which Shift no, Start time. End time. if start time of shift is 6pm and end time of shift is 6 am then I want to select record between start time and end time.I need query to selct such record.
6
1447
by: pukhton | last post by:
Hello~ Just a quick question about Access Reports. I want to have a form for user where they will have two textbox and one combo box to pick from and run the query based on that. 1 txtbox is for start date 2 txt box is for end date and combo box is for to pick the person name
1
2034
by: gazsharpe101 | last post by:
Hi, I have a problem which should have a relatively simple solution, I just cannot find it. I have a select query which gives me the following results: Company_Name Staff_FirstName Staff_Surname Staff_DOB ABC Ltd Joanne Robinson 08/12/1950 DEF Ltd Kevin Smith 25/04/1963 ABC Ltd Paul Jones ...
1
4080
by: yemvee | last post by:
Sir, I have a table named "RELATIONS_MASTER". Content of the table is below. CODE | PARENT | CHILD | LEVEL | -------------------------------------------------------------- A01 | Red Bull | Red Eye | 01 B01 | Blue River | Blue Gun | 01 A11 | Red Eye | Red Sand | 02 A21 | Red Sand | Red Rock| 03 B11 | Blue Gun | Blue Bell | 02
4
5948
by: heart01 | last post by:
I find myself here again...I am using access 2007 and I have three Reports. What I am thinking I would like to do is have a single list box.combo box? whereby I can select a report and then be able to and or select a date range for that report and then be able to print. I hope this makes sense... so select a specific report Product Outgoing Suppliers
2
1786
by: Jeffrey Tan | last post by:
Hi there.. So i am trying to email a parameter query report that takes in a date formatted to m/yyyy and compiles a report based on the specific month and year. however, when i click the command button to email the report, the input box window pops up, i type in a month and year, say 6/2010, then hit enter and then it breaks into the following code highlighting it yellow: DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF,...
0
8631
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
9055
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
8945
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,...
1
6550
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
5889
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
4392
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...
0
4641
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3075
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
3
2016
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.