G
Guest
Need assistances
I have a form that will create user login for my database. Its unbound.
I need a way where if the admin click the "Add user" button, before the data
copies to the table, it looks at the table to see if there is any dups. If
there is then error msg should appear promptin user that User name has
already been taken, try again, if not, then add and clear form after
the code i got only adds but doesn't "refresh" the form, all teh data is
still there. Please advise. Thanks
code:
Sub Add_Users()
Dim currentDbs As Database
Dim rcsTable As Recordset
Set currentDbs = CurrentDb
Set rcsTable = currentDbs.OpenRecordset("Employees", dbOpenDynaset)
'Loops through Table Definintions and appends Table Names to Table
rcsTable.AddNew
rcsTable("Employees") = Forms![New User]![Employees]
rcsTable("Novell Login") = Forms![New User]![Novell Login]
rcsTable("Password") = Forms![New User]![Password]
rcsTable("Email Address") = Forms![New User]![Email Address]
rcsTable("SecurityLevel") = Forms![New User]![SecurityLevel]
rcsTable("SOX Update") = "-1"
rcsTable("Date Created") = Date
rcsTable("Date Update") = Date
rcsTable("Created by") = Forms![New User]![Created by]
rcsTable.Update
Set currentDbs = Nothing
End Sub
I have a form that will create user login for my database. Its unbound.
I need a way where if the admin click the "Add user" button, before the data
copies to the table, it looks at the table to see if there is any dups. If
there is then error msg should appear promptin user that User name has
already been taken, try again, if not, then add and clear form after
the code i got only adds but doesn't "refresh" the form, all teh data is
still there. Please advise. Thanks
code:
Sub Add_Users()
Dim currentDbs As Database
Dim rcsTable As Recordset
Set currentDbs = CurrentDb
Set rcsTable = currentDbs.OpenRecordset("Employees", dbOpenDynaset)
'Loops through Table Definintions and appends Table Names to Table
rcsTable.AddNew
rcsTable("Employees") = Forms![New User]![Employees]
rcsTable("Novell Login") = Forms![New User]![Novell Login]
rcsTable("Password") = Forms![New User]![Password]
rcsTable("Email Address") = Forms![New User]![Email Address]
rcsTable("SecurityLevel") = Forms![New User]![SecurityLevel]
rcsTable("SOX Update") = "-1"
rcsTable("Date Created") = Date
rcsTable("Date Update") = Date
rcsTable("Created by") = Forms![New User]![Created by]
rcsTable.Update
Set currentDbs = Nothing
End Sub