Hello,
I figured out how to change a users password using a recordset, but now I'm trying to create a new entry in my table using a recordset as well, and I can't figure out how to make it work. I'm not sure what I'm doing wrong, because for some reason it keeps popping up the "user already exists" but then I go and look at the table and there is no such user. Am I doing something wrong that the updates I'm making to the recordset aren't updating in the table for some reason? This is the code I'm using:
Code:Private Sub cmdCreateUser_Click() Dim rs As Recordset Dim db As Database Dim tempUserID As String Set db = CurrentDb Set rs = db.OpenRecordset("Users", dbOpenDynaset, dbSeeChanges) Me.lblAlready.Visible = False Me.lblFullAlready.Visible = False rs.FindFirst "Username = '" & Me.txtUserName & "'" If rs.NoMatch = True Then rs.FindNext "[Full Name] = '" & Me.txtFullName & "'" If rs.NoMatch = True Then rs.AddNew rs!ID = Me.txtID rs![Full Name] = Me.txtFullName rs!Username = Me.txtUserName rs!Password = Me.txtPassword rs!Admin = Me.chkAdmin.Value rs.Update 'clear boxes Me.txtFullName = "" Me.txtUserName = "" Me.txtPassword = "" Me.chkAdmin.Value = False Exit Sub Else Me.lblFullAlready.Visible = True End If Else Me.lblAlready.Visible = True Exit Sub End If End Sub
Edit: How do I post code and get the formatting to copy over? I apologize for it being entirely left justified, this isn't how I write code! Figured it out!


Reply With Quote
)

