title: replacing (Date_format,Case) in MySQL format into (Format,IIF) in ms-access format
body: <p>I have two table like this</p>
  
  <p>1.HR_Personnel</p>
  
  <pre><code>+-----+---------------+--------+
  | ID  | NIP           | Name   |
  +---------------------+--------+
  | 1   | 050803075200  | Teguh  | 
  | 2   | 050803075201  | Supomo | 
  +-----+---------------+--------+
  </code></pre>
  
  <p>2.TA_Record_Info</p>
  
  <pre><code>+-----+-----+---------+-----------------------+
  | NIP | NIP | Nama    | Date_Time             |
  +-----+-----+---------+-----------------------+
  | 2   | 2   | Supomo  | 2013-02-20 07:45:57   | 
  | 2   | 2   | Supomo  | 2013-02-20 17:24:13   | 
  | 1   | 1   | Supomo  | 2013-02-20 18:18:07   | 
  | 2   | 2   | Supomo  | 2013-02-21 07:53:40   | 
  | 2   | 2   | Teguh   | 2013-02-21 20:31:02   | 
  | 1   | 1   | Teguh   | 2013-02-21 17:31:57   | 
  +-----+-----+---------+-----------------------+
  </code></pre>
  
  <p><code>Date_Time</code> is in string format.</p>
  
  <p>And then I want to make it like this table:</p>
  
  <pre><code>+----------------+---------+-------------+-------------+-------------+
  | NIP            | Nama    | Date        | In          | Out         |
  +----------------+---------+-------------+-------------+-------------+
  | 050803075200   | Teguh   | 2013-02-21  |             | 18:18:07    |
  | 050803075200   | Teguh   | 2013-02-20  |             | 20:31:02    | 
  | 050803075201   | Supomo  | 2013-02-20  | 07:45:57    | 17:24:13    | 
  | 050803075201   | Supomo  | 2013-02-21  | 07:53:40    | 17:31:57    |
  +----------------+---------+-------------+-------------+-------------+
  </code></pre>
  
  <p>I have Try in MySQL Query based on the answer my previous question <a href="https://stackoverflow.com/questions/18227191/datetime-string-to-date-in-time-and-out-time?noredirect=1#comment26725606_18227191">DateTime String to Date, In Time and Out Time</a>. It's successfull. this is query code:</p>
  
  <pre><code>SELECT p.Per_Code as NIP,
     p.Per_Name as Nama,
     DATE_FORMAT(a.Date_Time, '%Y-%m-%d') as date,
     Case Min(a.Date_Time)
      When Max(a.Date_Time) 
       Then '' 
       Else DATE_FORMAT(a.Date_Time, '%H:%i:%s') 
     End as InTime,
     DATE_FORMAT(max(a.Date_Time), '%H:%i:%s') as OutTime
  FROM  HR_Personnel as p
  RIGHT JOIN  TA_Record_Info a
  ON p.ID=a.Per_ID
  Group By NIP,
       Nama,
       DATE_FORMAT(Date_Time, '%Y-%m-%d')
  </code></pre>
  
  <p>You can see MYSQL Query Testing <a href="http://sqlfiddle.com/#!9/96daa/1" rel="nofollow noreferrer">in Here</a> </p>
  
  <p>And then I have try it in ms Access but still Not Working. This is the query code:</p>
  
  <pre><code>SELECT p.Per_Code AS NIP,
     p.Per_Name AS Nama,
     Format (a.Date_Time, "yyyy-mm-dd") as date,
     IIF(
         (Min(a.Date_Time) = Max(a.Date_Time)) ,
          '',
          Format (a.Date_Time, "hh/mm/ss")
     )as InTime,
     Format (Max(a.Date_Time), "hh/mm/ss") AS OutTime 
  FROM HR_Personnel AS p 
  RIGHT JOIN TA_Record_Info a 
  ON p.ID=a.Per_ID 
  GROUP BY p.Per_Code,
           p.Per_Name,
           Format (a.Date_Time, "yyyy-mm-dd")
  </code></pre>
  
  <p>I have try that in my PDO:Querry but still show error message:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function fetch()</p>
  </blockquote>
  
  <p>I don't know how testing in ms-access. I just know <code>PHP and MySql</code>. I use <code>ms-access</code> database because my Information system connected with a fingerprint that only have ms-access database.<br>
  What must i do to solve this problem?</p>