title: VB6 mySQL update problem
body: <p>Hey all, i am having a weird problem with trying to update a record in my mySQL 5 database using VB6.</p>
  
  <p>This is my code when i log in:</p>
  
  <pre><code>connDB
  Set rst = New ADODB.Recordset
  
  strSQL = "SELECT id, fName, lName, theCode, theDate, clockin FROM clockinout WHERE theCode = '" &amp; theUsersUniqueID &amp; "' AND theDate = '" &amp; Format(Now, "YYYY/MM/DD") &amp; "'"
            rst.Open strSQL, conn, adOpenDynamic, adLockOptimistic
  
  If rst.EOF Then
      rst.AddNew
      rst!FName = userFNmae
      rst!LName = userLName
      rst!theCode = theUsersUniqueID
      rst!theDate = Format(Now, "YYYY/MM/DD")
      rst!clockin = Format(Now, "YYYY/MM/DD HH:MM:SS")
  Else
      rst!clockin = Format(Now, "YYYY/MM/DD HH:MM:SS")
  End If
  
  rst.Update
  rst.Close
  Set rst = Nothing
  conn.Close
  </code></pre>
  
  <p>This works just fine without any errors. However, when i log out using this code:</p>
  
  <pre><code> connDB
   Set rst = New ADODB.Recordset
  
   strSQL = "SELECT id, fName, lName, theCode, theDate, clockout FROM clockinout WHERE theCode = '" &amp; theUsersUniqueID &amp; "' AND theDate = '" &amp; Format(Now, "YYYY/MM/DD") &amp; "'"
   rst.Open strSQL, conn, adOpenDynamic, adLockOptimistic
  
   If Not rst.EOF Then
       rst!clockout = Format(Now, "YYYY/MM/DD HH:MM:SS")
   End If
  
   rst.Update
   rst.Close
   Set rst = Nothing
   conn.Close
  </code></pre>
  
  <p>It comes out with an error saying its EOF since it can not find the record for some reason... Its in there because it worked on the first login. Strangely, when i take out <strong>clockout</strong> and replace it with <strong>clockin</strong> it <strong>FINDS THE RECORD</strong> but can not update it since rst!clockout was not in the query!!!! But when i <strong>do</strong> put it back into the query in place of clockin, it gives me the EOF error....</p>
  
  <p>My database record looks like this:</p>
  
  <pre><code> ID | fName | lName  | theCode | theDate    | clockin             | clockout         |
   26  Bob     Barker   5810      2010/08/02   2010-08-02 02:44:28   0000-00-00 00:00:00
  </code></pre>
  
  <p>Any help would be great as i have no idea why this simple update is giving me such a hard time..</p>
  
  <p>David</p>
  
  <p><strong>I have also tested the query in the mysql query browser and all works fine...</strong></p>
  
  <p>SELECT id, fName, lName, theCode, theDate, clockin, clockout FROM clockinout WHERE theCode = '5810' AND theDate = '2010/08/02';</p>