How do I create a query to return just one record, a minimum value for one of the fields, per group within a group that contains an ID field?
This is what my query is returning:
ID, UPC, MinOfAverage Unit Cost
19161, 026851003663, $1.15
15927, 026851003663, $1.11
4459, 026851003663, $1.18
19598, 029695215513, $39.73
15993, 029695215513, $39.29
11694, 029695215513, $48.81
This is what I need:
ID, UPC, MinOfAverage Unit Cost
15927, 026851003663, $1.11
15993, 029695215513, $39.29
I would be *extremely* grateful for an answer. I am new to this list, but I have plenty it MS Access help karma to my name, so I'm hoping to cash some of that that in.
I have a date field in a form fed by an option group. Most of the options return the correct values, but I'm having a hard time with this:
If the inspection date (in another form) is in Jan Feb or March, then return the date 1 Apr of the inspection year. If not, then return 1 Apr of the following year.
I have a table which has repeated IDs, I want to find the start of the ID then mark it as Y in the next field, the remaining repeated IDs should have blanks in the next field, how do I do this, thanks for any help
I have a counter on my form which will increase or decrease depending on weather a number of tick boxes report true or false. Is it possible to set a minimum aloud value on a box regardless of other criteria. At present I can depending on certail criteria, finish up with a - number which for other reasons, I dont want.
I have a main form and 5 tabs within that mainform that are subforms. They are linked by an EventID.
The subforms are continuous forms, but only one record is "required". What kind of code do I need to make sure that the data entry person enters at least one record in each subform.
Also, is there a way that when I am tabbing through my subform and get to the second record and leave it blank, that when I press tab it will take me to the first record of the next tab subform.
I have a simple UDF that takes a string and returns a variant, which is an array of strings Example Input "Brick Wall" Return value would be a variant array with first element "Brick" and and second element "Wall" Now I have a table with a field of strings, and I want to make a query that returns all the results from the function, one per line.
So if my input table looks like this
[strField] "kick the ball" "return the pass"
my query result should looks like this
[Orig] [new] "kick the ball" "kick" "kick the ball" "the" "kick the ball" "ball" "return the pass" "return" "return the pass" "the" "return the pass" "pass"
Last time I had to do something like this I used VBA exclusively, with ADO objects, but I thought a query based solution would be easier.
With my current data the largest return array size my function returns is 27 elements but I wouldn't want to rely on that number being fixed.
I have a field in a report that is calculated to generate a dollar amount. Well the people who need this have some strange rules about how they get their dollar amounts. Mostly they just round up to the nearest dollar, which is no problem. But they also want a minimum charge of $2.00. So my problem is if the calculation works out to be 0.01 to 1.00, it will say 1.00 and it is going to be wrong because they will want it to be 2.00. So is there a way to set a minimum value for this field, or where should I go to try this?
I have a query that is working, but I am looking to make it faster. We import 13 csv files daily into 13 Access tables. The files have an ItemID and price. We need to get the minimum of the raw data across the 13 tables & then manipulate the prices some (in the query) and get the lowest of the manipulated prices again for the 13 tables for each ItemID - some might be blank. We are using a MinOfList function in the query to get the minimum of the 13 numbers. But this is very time consuming since we have to run the Min function twice (with 13 input parameters) for each ItemID - about 15,000 records. It takes about 1 minute to run the query.
What I am doing is trying to have access identify and label various lanes of transit.
So, for example. I have the below...
Origin Destination Via Transit Time Hong Kong New York East Coast 38 Hong Kong New York West Coast 32 China New York East Coast 34 China New York West Coast 29
Is there a way in Access to have it identify that Hong Kong to NY via West Coast is the "DEFAULT" where HKG to NY via East Coast would be "ALTERNATE" ?? And then do the same for the next origin? The table I have now has over 71 different origins but I need it look at each origin independently.
Does anyone have a good technique for enforcing a minimum number of records in a table?
I am attempting to ensure that in a table of Roles, there be a minimum of two Roles defined as Technicians. The field which identifies a Role as Technician is a Boolean.
I wrote a Function which does a domain lookup to count the number of Roles defined as Technician and am calling it from the BeforeUpdate event.
However, if there are 2 Technician Roles, and I mark a third Role as Technician, change my mind and try to unmark it...of course the Function can still see just the 2 existing.
I realize I can Undo the edit, but a user may not.
I´ve had this problem for a while but it only just recently became very annoying.
I have a chart on a form displaying data over time. I´m using two comboboxes to select start date and end date. There are A LOT of data in the underlying query. However the problem does not seem to be related to that.
When I select the starting date to be before a certain date, the chart suddenly sets its own minimum to 0 so that the line in the chart becomes almost flat (since the data reaches from maybe 20 to mayb 25).
This has to be a common problem, but is there a good solution?
I´ve checked the data so there´s no problem there.
I'm trying to get my query to display only the minimum value within my query results. I have the following fields, CustomerID, OrderID, ProductID, WarehouseID, Freight Cost.
My current query will return results that show me the locations and freight cost of each product to my customers. My intention is for the query to only return records that has the lowest freight cost as there may be several warehouses with identical products but with varying freight costs due to location to customer.
I've tried to apply the MIN function on Freight Cost but it will only sort the records in ascending order instead of only displaying the record with lowest frieght cost.
The database I'm working on is used for personnel budget projections. Because some employees are hired mid-year, I need to be able to use various dates in my projection calculations.
I have 3 different tables - one with the employee start date, the other with the fiscal year start date, and the last with the start date of certain special pay tables. In order for my projections to work correctly, I'll need to return in a query the minimum of these 3 dates. I know how to do a minimum value in a single field within a table, but don't know how to select a minimum from multiple values in multiple tables. Is this possible.:rolleyes:
Hi. I have one table with dates (1) and object properties. Another table has dates (2) and other info. What I need is a query that selects the dates (1) closest to date (2) and lists the respective properties.
I figured all I needed to do is a WHERE MIN (dates(2)-dates(1)) query. The problem is that Access (2000) rejects this query b/c aggregate functions are not allowed in WHERE statements.
Does anyone have an idea of how to work around this? The structure of the data is such that there will only be one minimum date > 0.
I have a normalised table containing the following fields:
<Unique ID> <Fund Name> <Date> <Return>
The data are time series denoting the monthly performance of investment funds. Funds can have any number of observations (e.g. March 1997 to June 2005). In addition, some funds can have performance gaps.
I would like to extract those funds that have a continuous performance history of 120 consecutive months between a specific start and end date. As an exmaple, the start date is July 1990 and end date June 2010:
- Fund A: performance history July 1995 to June 2005 (= 120 consecutive observations) INCLUDE - Fund B: performance history July 1995 to June 2007 (> 120 consecutive observations) INCLUDE - Fund C: performance history July 1995 to June 2000 (< 120 consecutive observations) EXCLUDE - Fund D: performance history July 1995 to and June 2000 August 2000 to June 2007 (> 120 observations but gaps) EXCLUDE - Fund E: performance history July 1985 to June 1995 (= 120 consecutive observations but only 60 after start date) EXCLUDE
how to build a query around this? Perhaps this needs implementation in VBA. Ideally, I would like to be able to select the start and end date dynamically and then run the query accordingly.
How to find the Minimum value of a column. This is my SQL:
SELECT * FROM tblFinalMaster WHERE (((tblFinalMaster.OperatingDay)=[forms]![frmEnterParameters]![Combo13]) AND ((tblFinalMaster.[Checkout Order])=([Forms]![frm01ATFTieLineCheckout]![Checkout Order])+2) AND ((tblFinalMaster.[From BA_REPORT])=[forms]![frmEnterParameters]![Combo5]) AND ((tblFinalMaster.[TO BA_REPORT])=[Forms]![frmEnterParameters]![Combo3]));
The part in blue, instead of pulling a +2, I want the Minimum value. Seems simple enough.
I have six textboxes in my form. First 5 textboxes have dates ( MMDDYYYYY). In the sixth textbox I need to display the minimum date among these five dates.
I have an Access table with a field called Purchase Oreder Item. The field must be all numbers and the length can be from 10 characters to fourteen characters. I have no problem requiring all numeric characters with a validation rule and setting a maximum length with the input mask. The problem is requiring the minimum of ten numeric characters. The operator must enter a minimum of ten characters and no more than fourteen. Please help.
I am trying to produce a database that will select a swimmers, best time for each event, and will select the overall best time done by any swimmer in the events.
At the moment I am having some trouble with my queries.
When trying to get the query to select a swimmers best time for the events, It will work when selecting min for the time field and including the following fields: Forename Surname Stroke Distance Age group Gender
However I also wish to include the name of the swimming pool the time was done at and the date at which it was achieved. My problem is that when I add these fields into the query, it looks for the swimmers minimum time in the event, on the date, and at the venue and consequently comes up with all the times the swimmer has done, rather than just the best ones.
I would Really appreciated if anyone had any suggestions as to how I can get over this problem
hi all, I've got one question regarding dates. I've already make the form to show the count of records by using query according to the start and end date selected by the user. What I want is when I open the form, it should show the results of count between the minimum and maximum dates inside the data table. It means I want to show the count result without date specification that is the total count from all records of the whole table .
Can anyone help me how can I make it? thanks a lot in advance.
I am trying to set up a calculated field in one of my form querries, using expression builder.
In one of my source tables I have 4 date fields called Inspection date 1 to 4
I need the lowest date among those inspectinos which are in the future (next inspection) If all 4 dates are in the past or Nulls, the function should return the current date. The logic of the expression could be:
The built-in functions DMin and Dmax work with single field arrays, witch would be perfect if the database were properly designed, but now I dont have the power to change this.