Thread: Chapter 15!!
View Single Post
  #12 (permalink)  
Old March 10th, 2004, 08:33 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yeah, that is the error I'd expect, and was what I was referring to in my previous post.

Here's what happens in pseudo code:

Open Recordset
Filter for User
If User Does not Exist Then
    Create User with INSERT statement
End If

At this point, the Recordset will not contain a record. The recordset was EOF (End of File initially), and will still be EOF, even after you have added a user with the INSERT statement. After the INSERT statement executed, the Recordset is *not* populated again to reflect the changes. So:

  For each strField in rsUsers.Fields
      strValue = strField.value

is likely to cause a problem because there is no current record. You'll have to open the Recordset again using its Open method, or you should reuse the stuff from the form (Request.Form("password")) etc in the case of a new user.

Does that make sense?

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.