Search results

  1. J

    SQL Query question

    You can do it with a series of three queries. qryOne:- SELECT UseCaseID, Max(NoteDate) AS MaxOfNoteDate FROM UseCaseNotes GROUP BY UseCaseID; qryTwo:- SELECT UseCaseNotes.* FROM UseCaseNotes INNER JOIN qryOne ON (UseCaseNotes.UseCaseID = qryOne.UseCaseID) AND (UseCaseNotes.NoteDate =...
  2. J

    Parameter issue.

    I think it's the double-quotes that you used. You need to use "C", not “C” as seen in your code. .
  3. J

    parameter with IN clause

    See the query in the sample database in this thread http://www.access-programmers.co.uk/forums/showthread.php?t=96629 .
  4. J

    Cross Tab Query Nulls

    It's strange. I suggested this solution to others more than once and I got feedback that it worked. http://www.access-programmers.co.uk/forums/showthread.php?t=64141&highlight=Transform http://www.access-programmers.co.uk/forums/showthread.php?t=79457&highlight=Transform .
  5. J

    Cross Tab Query Nulls

    Try using Nz(....)+0 in your crosstab query e.g. TRANSFORM Nz(Sum([FieldName]))+0 AS SumOfFieldName .
  6. J

    Calculate total number of days between two dates in a query

    NumberOfWorkingDays: [EndDate]-[StartDate]+1 -(DateDiff("ww",[StartDate],[EndDate],7)-(Weekday([StartDate])=7)) -(DateDiff("ww",[StartDate],[EndDate],1)-(Weekday([StartDate])=1)) .
  7. J

    How can I select only the rows I need?

    You can get the min Rate of each Sorter in a Totals Query and join the query back to the table in another query to retrieve the records. qryOne:- SELECT Sorter, Min(Rate) AS MinOfRate FROM [TableName] GROUP BY Sorter; qryTwo:- SELECT [TableName].* FROM [TableName] INNER JOIN qryOne ON...
  8. J

    Grouping and Counting Issue - HELP!

    Instead of counting and summing fields, you can sum expressions e.g. Profitable (count): -Sum([ProfitLoss]>0) Total $ of losses (sum): Sum(IIf([ProfitLoss]<0, [ProfitLoss], 0)) .
  9. J

    A query for multiple check box combinations

    See the query in the database attached. It uses IIF expressions as criteria. The query displays all the fields from the table. If you want the query to display only those fields that the user has checked on the form, you will need to use VBA to build the query on the fly. .
  10. J

    Splitting Field - SQL?

    Try these expressions for the two new fields:- NewField1: IIf(Len([FieldName])=5, Left([FieldName],1), "") NewField2: IIf(Len([FieldName])=5, Right([FieldName],3), [FieldName]) .
  11. J

    Combine fields from one table without duplicates

    Try this query:- SELECT [LOOKUP-BARCODES-10].COM_DATA_KEY, [LOOKUP-BARCODES-10].COM_DATA_VALUE, [LOOKUP-BARCODES-20].COM_DATA_VALUE AS [COM_DATA_VALUE (2)] FROM [LOOKUP-BARCODES-10] LEFT JOIN [LOOKUP-BARCODES-20] ON [LOOKUP-BARCODES-10].COM_DATA_KEY = [LOOKUP-BARCODES-20].COM_DATA_KEY; Since...
  12. J

    Get some values and the inmediatly previous ones based on a date whithin a range...

    It's far too complicated for queries. You'd be better off using VBA to update a temporary table. .
  13. J

    Not Pulling all the records for last 24 hours

    You have to move the criteria for the [Planned-Start] field to a Where Clause in the query as it is for record selection. SELECT ........ FROM .......... WHERE [48_Hour_Pull].[Planned-Start] Between DateAdd("d",-3,Date()) And DateAdd("d",0,Date()) GROUP BY ....... HAVING...
  14. J

    Not Pulling all the records for last 24 hours

    You have not applied the filtering condition in your query correctly. The Where Clause in a query filters records. The Having Clause in a Totals Query filters returned results. So to filter records, you have to put the record selection criteria in the Where Clause of the query, not in the...
  15. J

    Multiple Criteria Query Using Combo Boxes

    See MyQuery in the database. .
  16. J

    Stuck with dates

    Make sure the EndIssue field in the table is a Date/Time field, i.e. not a Text field. And make sure the date entered when the query is run follows the system date format, i.e. whether it should be mm/dd/yyyy or dd/mm/yyyy. For parameter queries, it would be better to let the user enter the...
  17. J

    Not Pulling all the records for last 24 hours

    Try this criteira for the Planned Start field: between Date()-1 and DateAdd("s",-1,Date()) When the query is run on 28 January, it should pull all records with Planned Start between 27/1/2008 0:0:0 and 27/1/2008 23:59:59 .
  18. J

    Not Pulling all the records for last 24 hours

    We need more detail on two points: 1) In post #7 you wrote: "I am looking for all records for the last 24 hours. or the last day from midnight to midnight" By "the last day from midnight to midnight", do you mean if the query is run anytime today 28 January, you want it to pull all records...
  19. J

    DateDiff Function

    Date/Time fields are internally double precision numbers. [TimeOut]-[TimeIn] returns the elapsed time in Days. As there are 24 Hours in a day, you can get the elapsed time in hours with the expression: ([TimeOut]-[TimeIn])*24 You can round it to e.g. 4 places of decimal like this...
  20. J

    open query...

    See the new form and queries in the database. Since the part numbers are 13 digits long, I have used a combo box for the user to select a number instead of using a text box for the user to enter a long number. The query "qryUnionParNom" is used as the Row Source of the combo box. .
Back
Top Bottom