Search results

  1. E

    DatePart in query use

    Provided that the data in the field are of date/time data type ie not text strings, you can use the Format() function:- Field: Format([DateTimeField], "hhnnss") Show: uncheck Criteria: Between "090000" and "173000" ^
  2. E

    I can't get this to work IIf function work for me

    Try changing the two Nulls to 0 and the Or to + ^
  3. E

    Query Criteria

    As Jon's sample database shows, the Distinct predicate returns a non-duplicate list. Did you by any chance use the Top 1 predicate instead of Distinct? Top 1 returns the first row from the list. ^
  4. E

    User prompt date criteria not including end date

    Adding 1 day to ending date works so long as there are no records exactly at mid-night. ^
  5. E

    User prompt date criteria not including end date

    If the date field contains also the times, see discussions in this thread. http://www.access-programmers.co.uk/forums/showthread.php?t=134835 ^
  6. E

    UPDATE query not working with date value

    Date is a function name. It's better to use another name for the field though sometimes putting [Date] in a SQL statement works. When you delimit strDate with the # signs, the date in strDate needs to be a text string in US date format i.e. m/d/yyyy or mm/dd/yyyy. ^
  7. E

    Multiple parameter query

    See this link and its notes. http://www.access-programmers.co.uk/forums/showthread.php?t=103312 ^
  8. E

    WHERE clause in SQL string

    You need to have a space between the table name and the word WHERE. ^
  9. E

    querying time stamped date field

    One more option. You can use the DateValue() function to extract the dates. In query SQL View, you can change the Where clause to:- WHERE DateValue([DateTimeField]) Between [Select Start Date] And [Select End Date] But the following should be more efficient than extracting the dates from the...
  10. E

    Check Field Names

    Invalid Operation because fld is a field object. What you need is the field's name property. Select Case fld.Name ^
  11. E

    DISTINCT predicate

    It may take a while because not many people have Access 2007 and less still who have used DistinctRow in it. Quoted from Access 2003 Help: ------------------------------------------------- The following SQL statement shows how you can use DISTINCTROW to produce a list of companies that have at...
  12. E

    Breakout Query for prices

    I just repeated the Where clause in your subquery. So if the Where clause worked in your original query, it should also work in the subquery. Anyhow I've no problem running the statement. It returned the following results in the attached database. Symbol AlphaDeliveryMonth transdate DClose...
  13. E

    DISTINCT predicate

    I don't have Access 2007. In all the versions of Access that I have, it seems Distinct filters query results whereas DistinctRow filters records in linked tables. I needed DistinctRow only in delete queries that were joined with another table e.g. DELETE DISTINCTROW Table1.* FROM Table1 INNER...
  14. E

    Query Behavior Acess 2003

    Please post the SQL statements of the query that works and the one that doesn't. ^
  15. E

    Breakout Query for prices

    The following may be what you are after. SELECT WZ07.Symbol, WZ07.AlphaDeliveryMonth, DateSerial(Val(Left([ddate],4)),Val(Mid([ddate],5,2)),Val(Right([ddate],2))) AS transdate, WZ07.DClose FROM WZ07 WHERE DateSerial(Val(Left([ddate],4)),Val(Mid([ddate],5,2)),Val(Right([ddate],2))) Between...
  16. E

    Make Table Query and Expression Names

    Please post the SQL statement of your query, that is the statement in query SQL View. ^
  17. E

    Format % in query

    "" is a zero-length string so the whole column becomes text strings, not numbers. You can use Null instead of "" in the IIF. ^
  18. E

    Problem with GROUP BY [Date Time]

    You can use the DateValue() function to extract the dates. SELECT DateValue(T.[Date Time]), sum(Commission) AS TotalCommission tblTransactions AS T WHERE T.[Date Time]<=#04/17/07# GROUP BY DateValue(T.[Date Time]); ^
  19. E

    Problem with Sub-Query

    SellDate is an alias. We can't use aliases of calculated fields in subqueries. You need to replace it with its original expression. (SELECT [Price] FROM tblTransactions WHERE [Ticker]=T.[Ticker] AND [Date]=(Select Top 1 [Date] from tblTransactions where [ticker]=t.[Ticker] Order By [Date]...
  20. E

    Problem with Sub-Query

    Hopefully this is what you are after: SELECT T.Ticker, (Select Top 1 [Date] from tblTransactions where [ticker]=t.[Ticker] Order By [Date] Desc) AS SellDate FROM tblTransactions AS T GROUP BY T.Ticker HAVING Sum(T.Quantity)=0; ^
Back
Top Bottom