473,705 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Record Sources


Hi there,

I have posted about this before, but yet to arrive at a solution. I am
going to try to explain this better.

I have an Employees table and a Datarecords table (one-to-many
relationship). I have fields called InventoryOut and BalanceEnd that
are calculated on the fly for reports and when displayed on forms (they
are not part of any table). I have another field called "BalCarFor"
(Balance Carried Forward) that is part of the DataRecords table, but,
ideally, should not be. In other words, the user should not have to
enter the balance carried forward--it should be calculated
automatically.

I know how to do a query that will retrieve the exact record containing
the "BalanceEnd " that will equal the BalCarFor of the current record
being displayed (for instance, on a form). What I don't know is how to
base a form or report on multiple record sources.

For instance, I have a form based on the DataRecords table. I can
browse/edit/etc. any record. If I created a text box for BalCarFor, for
the current record being displayed from the DataRecords table, an
underlying query for this text box would retrieve a value from another
record in the DataRecords table. It needs to do this because the
BalCarFor is calculated based on values in another record.

Basially, the BalCarFor would need to be based on a specific query, and
it would perform this query being dependant on what record is being
displayed from the DataRecords table. If the record being displayed is
"Joe, Team A, April, 2003" then the BalCarFor would be based on a prior
existing record for, perhaps, "Joe, Team A, March 2003."

Displaying the BalCarFor is important for when the user enters data.
She wants to be able to see it. It is more important for the reports.
Basically, for the reports I am in the same situation--I need to have
the report based on one record source, and the BalCarFor based on
another record source--and the query that BalCarFor is based on will
have criteria determined the current record from the DataRecords table.

Any idea how I could do this? Sorry if this reads like a riddle.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
3 3578
Base the form on a query that will contain a field BalCarFor.
This basically means that you "precalcula te" BalCarFor for all users in
advance, just like you have it in your table. I am guessing that this
value is going to come from a GROUP BY query and your form needs to be
based on an updateable dataset, so you can't use a Group by quwery
directly - you need to use it to jiin the table to it.
Another way that is perhaps simpler is to use DSum, which will let you
produce the BalCarFor based on the customer selected, but will not be a
part of the dataset.

Pavel

Steven Stewart wrote:

Hi there,

I have posted about this before, but yet to arrive at a solution. I am
going to try to explain this better.

I have an Employees table and a Datarecords table (one-to-many
relationship). I have fields called InventoryOut and BalanceEnd that
are calculated on the fly for reports and when displayed on forms (they
are not part of any table). I have another field called "BalCarFor"
(Balance Carried Forward) that is part of the DataRecords table, but,
ideally, should not be. In other words, the user should not have to
enter the balance carried forward--it should be calculated
automatically.

I know how to do a query that will retrieve the exact record containing
the "BalanceEnd " that will equal the BalCarFor of the current record
being displayed (for instance, on a form). What I don't know is how to
base a form or report on multiple record sources.

For instance, I have a form based on the DataRecords table. I can
browse/edit/etc. any record. If I created a text box for BalCarFor, for
the current record being displayed from the DataRecords table, an
underlying query for this text box would retrieve a value from another
record in the DataRecords table. It needs to do this because the
BalCarFor is calculated based on values in another record.

Basially, the BalCarFor would need to be based on a specific query, and
it would perform this query being dependant on what record is being
displayed from the DataRecords table. If the record being displayed is
"Joe, Team A, April, 2003" then the BalCarFor would be based on a prior
existing record for, perhaps, "Joe, Team A, March 2003."

Displaying the BalCarFor is important for when the user enters data.
She wants to be able to see it. It is more important for the reports.
Basically, for the reports I am in the same situation--I need to have
the report based on one record source, and the BalCarFor based on
another record source--and the query that BalCarFor is based on will
have criteria determined the current record from the DataRecords table.

Any idea how I could do this? Sorry if this reads like a riddle.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2
I think the DSum might be the way to go, but let me explain a bit more.

Basically, for the current record displayed on the form, I need a
calculated text box that has a control source based on this:

SELECT Trim([EmployID]) & Trim([Team]) & Trim([Province]) &
Trim([LocalOffice]) & Trim([Program]) AS Expr1, Sum([5198]-[5197]) AS
BalCarFor, Max(DataRecords .Month) AS MaxOfMonth, Max(DataRecords .Year)
AS MaxOfYear
FROM DataRecords
GROUP BY Trim([EmployID]) & Trim([Team]) & Trim([Province]) &
Trim([LocalOffice]) & Trim([Program])
HAVING (((Trim([EmployID]) & Trim([Team]) & Trim([Province]) &
Trim([LocalOffice]) & Trim([Program]))="66Screening NewfoundlandN/ACPA")
AND ((Max(DataRecor ds.Month))<8) AND ((Max(DataRecor ds.Year))<2004) );

Is there a way to convert this into a DLookup or DSum or is it
impossible?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
It looks to me that you already have the BalCarFor field there. If you
save the query, you can then use it in DLookup but I think you need to
leave out the HAVING clause so that you can use the criteria chosen in
you form's contrls. You can assemble these criteria and pass them to
DLookup. You shouldn't need DSum since your stuff is already Summed in
the query.

Pavel

Steven Stewart wrote:

I think the DSum might be the way to go, but let me explain a bit more.

Basically, for the current record displayed on the form, I need a
calculated text box that has a control source based on this:

SELECT Trim([EmployID]) & Trim([Team]) & Trim([Province]) &
Trim([LocalOffice]) & Trim([Program]) AS Expr1, Sum([5198]-[5197]) AS
BalCarFor, Max(DataRecords .Month) AS MaxOfMonth, Max(DataRecords .Year)
AS MaxOfYear
FROM DataRecords
GROUP BY Trim([EmployID]) & Trim([Team]) & Trim([Province]) &
Trim([LocalOffice]) & Trim([Program])
HAVING (((Trim([EmployID]) & Trim([Team]) & Trim([Province]) &
Trim([LocalOffice]) & Trim([Program]))="66Screening NewfoundlandN/ACPA")
AND ((Max(DataRecor ds.Month))<8) AND ((Max(DataRecor ds.Year))<2004) );

Is there a way to convert this into a DLookup or DSum or is it
impossible?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3857
by: Steve | last post by:
I have a people table of about 25 fields. The table is initially created each year from 5 different sources. The records from each source are appended to the people table. Any person may be in one or multiple sources. For those in multiple sources, the data for a person may not be complete in any source. For example, a person is in three sources; source#2 has the SSN and source#3 has the membership#. For those people who are in multiple...
4
8782
by: Michael | last post by:
Hi, I have an Access database set up on a network drive that several users can access. The database has many queries but just one main form. I have designed a startup form where a user can select a query and the main form will be opened using that query as the record source. Does anyone know how this will behave when many users have the form open with different record sources? Whenever a user selects a new query and the record source is...
1
2722
by: Justin Koivisto | last post by:
I am trying to create a report that displays a name of an advertising source and count of the number of times it was hit between certain date ranges. The data is split between two different databases: this access db, and a remote MySQL server. The MySQL tables are linked in the access db. What I have done so far is created an On Open event for a report that does the following: * prompt user for the date range * get which sources were...
12
3228
by: (Pete Cresswell) | last post by:
I know I can open many instances of a given form, but I've never done it. Now I'm analyzing an application where that seems like just the ticket: Many investment funds, *lots* of data points for each fund, and a desire by the users to see several funds presented side-by-side. Is opening, say, five instances of the same form real-world-doable? -- PeteCresswell
3
5200
by: svdh2 | last post by:
I have been looking at a problem the entire week in access, I have still not been able to find a solution. Hope that you could maybe tell where to look Concerns the link between Access and Word. I can not transfer a report to word without losing out on the lay-out (RTF format). I understand that there is no way out ok, mail merge I thought. But here I have the problem that I need to merge multiple tables and that I can just include...
2
3403
by: Will | last post by:
I have a table, tblManinstructions with fields Code & InstructionID, one Code can have many InstructionID. I also have tblinstructions (fields instructionID & instruction). What I want to do is create a table with the fields Code and Instruction - a combination of all instructions from the instruction IDs in tblManinstructions). E.g. Code 1234 currently has 4 fields in tblManinstructions, instructionIDs 28, 43 & 76. The new table I...
8
22190
by: Mark Welch | last post by:
I am at a complete loss on how to do this. I am using Microsoft Access 2000, to implement a preliminary version of a reasonably modest relational database. I have two Access Tables (imported from MS Excel spreadsheets), and I need to somehow get the data for a "Person_ID" brought over from one to the other. In Table_A, there are many records for each person, and the first and last name are included, but the Person_ID field is empty....
1
3061
by: dhyder | last post by:
OK, like the title says my error is Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. I have looked into this a lot, but have not been able to find a solution to it. <%@ Page Language="c#" runat="server" debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %> <script runat="server"> OleDbConnection conn = new...
3
7749
by: Brett Barry: Go Get Geek! | last post by:
Hello, I just started using Access 2007 after using Access 2003 for a long time. I've created all my queries and they work fine. However, either I forgot or it has changed but, how do I create a report based off of multiple queries? I tried using the report wizard using one query. In the Properties sheet of the report, the record source for the report only shows one query. But if I try and add another text box and add the control
0
8771
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
9275
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9140
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...
0
8981
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
5934
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
4441
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
4705
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3140
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
2084
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.