473,468 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Opening a report from a form so that the last report is visable and sorted by a field

4 New Member
Table: Data
Form: Entry Form

Fields:
1) Department
2) DepartmentNumber
3) AccountExecutive
4) ReportDate
5) ID
6) 7 yes/no fields
7) 6 memo fields



Problem: I would like to be able to open the last updated report in the EntryForm form, filtered (filtering the best option?) by way of Department (open the report that was last entered for that department), so that it can be viewed while the individual is entering a new form.

Currently, I have a button set up to take me to the Data Reports, however, it lists all reports for all departments and does not go to the last one for the department.
I need to have it so that it filters each department, based on a department that I select, and also have it so that it goes to the last record of that department. I'm having a lot of trouble with this, I don't really even know where to start, it's been a while since I've used filters.
Mar 5 '08 #1
1 1282
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Table: Data
Form: Entry Form

Fields:
1) Department
2) DepartmentNumber
3) AccountExecutive
4) ReportDate
5) ID
6) 7 yes/no fields
7) 6 memo fields

Problem: I would like to be able to open the last updated report in the EntryForm form, filtered (filtering the best option?) by way of Department (open the report that was last entered for that department), so that it can be viewed while the individual is entering a new form.

Currently, I have a button set up to take me to the Data Reports, however, it lists all reports for all departments and does not go to the last one for the department.
I need to have it so that it filters each department, based on a department that I select, and also have it so that it goes to the last record of that department. I'm having a lot of trouble with this, I don't really even know where to start, it's been a while since I've used filters.
Hi Dave. terminology is a little confusing in your post, as you are referring to what must be user data as reports - easy to confuse with Access print-formatted reports.

The recordsource for your EntryForm form is either the Data table or a query based on that table. You can show users the most recent data by basing the recordsource for this form on a query (if it isn't already) that includes all fields from the Data table. The query would be sorted by report date in descending order.

To filter for a specific dept to view you can select a department by adding a combo box to the form with the Data Reports button you mention then applying a filter for the department when opening the EntryForm form.

The rowsource for the combo would be the table which holds your departments, and you would include the department number and department name in the combo. You could then apply a filter that filters the EntryForm records for the chosen department when the button you referred to is pressed. The code for this in the on-click event of your button is like
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me![name of your dept select combo]) then
  2.     DoCmd.OpenForm "EntryForm" 
  3. else
  4.     DoCmd.OpenForm "EntryForm",,,"[DepartmentNumber] = '" & Me![name of your dept select combo] & "'"
  5. endif
This assumes your department number is a string value. If it is a number, change the else part to
Expand|Select|Wrap|Line Numbers
  1.     DoCmd.OpenForm "EntryForm",,,"[DepartmentNumber] = " & Me![name of your dept select combo]
-Stewart
Mar 9 '08 #2

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

Similar topics

1
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that...
1
by: Shiz | last post by:
I currently have a Form with Option buttons (to give you the option of sorting by name, or by Field, etc), these are referenced in a module which then formats the report contingent on the option...
4
by: Terry | last post by:
I need some help refining an MS 2000 relational databse. I have created a simple relational database using two tables, 'Student Details', 'Exam Details' and two forms, 'Input/Edit Exam Details',...
1
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...
11
by: James P. | last post by:
Hello, I have a report with the Priority field is used as sort order and grouping. The problem is the data in this Priority field if sorted in ascending order is: High, Low, and Medium. How...
3
by: Michael | last post by:
Hello experts! I hope to tap your vast knowledge of unbound wisdom. Please help this humble squire in his search for knowledge. Product: MS Access 2003 I have a report that basically lists...
2
by: Prakash | last post by:
I have 2 tables ... Customer_Master: Cust-Code, Cust_Name Customer_Transactions: Cust_Code, Date, Details, Debit, Credit I would like to generate a report in the foll manner, say from...
1
by: anubis2k7 | last post by:
Hi, I am having a problem with dynamically sorting/grouping data in my report at runtime. My problem is that when the report is run using sorting/grouping I am missing data. Specifically, my...
12
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
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...
0
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.