SOLVED...

Results 1 to 8 of 8

Thread: SOLVED...

  1. #1
    Coopetj Guest

    Default SOLVED...

    rs.maxrecordset didnt work but "top 1" does.<BR><BR>I had two records with the same date. I didnt record the time. I know have to record the time just for sorting sake then display just the data.<BR><BR>What is the best way to do this? The field in the recordset will have both date and time.

  2. #2
    Join Date
    Dec 1969
    Posts
    1,849

    Default RE: SOLVED...

    You can test in a SQL select statement without returning any values...<BR><BR>eg:<BR>select datafield from table where ddate = &#039;1-1-01&#039;<BR><BR>This select statement will only select the datafield field from the records in the database that have the date 1-1-01 thus only returning one value.<BR><BR>-- Whol

  3. #3
    coopetj Guest

    Default NOT EXACTLY WHAT I MEAN..I WILL BE MORE CLEAR

    The problem arises from the fact I need to record both date and time in the dtPost field in order to return only one record usind the following SQL:<BR><BR>strQ = "select top 1 * from tblNews where recipient = &#039;allstaff&#039; order by dtPost Desc"<BR><BR>When I query the DB I will get date/time in this format (4/11/2001 4:09:33 PM). I want only the DATE. What can I do to just display the date. Trim? Is there a better way of using the "now()" function so it is easier to remove the time when displaying the information?

  4. #4
    Join Date
    Dec 1969
    Posts
    1,849

    Default date, time

    There is a command : date, which records the date, and time, which records the time... If you want to stick with now, the system formats it in a 2/3/4 format so you could probably use a left command...<BR><BR>left(datfield,8) and you will get the date only...<BR><BR>-- Whol


  5. #5
    coopetj Guest

    Default RE: date, time

    I thought about that too but what if its "4/11/2001 10:13:43 PM" vs "2/2/2001 4:24:33 PM" <BR><BR>left wouldnt work. I think im stuck.<BR><BR><BR>Thankf for the help<BR><BR>

  6. #6
    Join Date
    Dec 1969
    Posts
    1,849

    Default slam an instr in there

    left(dtestr,instr(1,dtestr," "))<BR><BR>It will find the spot where the space is and find the left of that...<BR><BR>I&#039;d redesign the database to have seporate fields for the date and time...<BR><BR>-- Whol

  7. #7
    coopetj Guest

    Default RIGHT ON!!! THANKS!!!

    Using your example I can up with the followng code:<BR><BR>&#060;%=left(rs("dtPost"),instr(1, rs("dtPost")," "))%&#062;<BR><BR>Amazingly enough it works. Thanks.

  8. #8
    Join Date
    Dec 1969
    Posts
    1,849

    Default RE: RIGHT ON!!! THANKS!!!

    Of course it works, the left will grab the left so many characaters in the string, the instr will tell you what postion the space is in (which is the number of chars from 0, which just happens to be the length of the date)<BR><BR>Happy programming!<BR><BR>-- Whol

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •