Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2005

Tip: Looking for answers? Try searching our database.

Help: When adding a user it adds a duplicate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rc51wv - 12 Dec 2005 21:05 GMT
I have a form that has three feilds, one being a drop down menu that are used
to add a user, password, and security level to a database. When you open the
form those fields bring up the first record in the table and can also be used
to browse and delete entries in the table. The problem I am having is this.
After you enter a user and open the form a second time, it adds a duplicate
entry to the table but without the password. Can any one direct me towards a
solution?

TIA

Code-----------------------------------------
Option Compare Database
-----------------------------------------------
Private Sub btnDelete_Click()

Dim db As Database
Dim rstUser As Recordset
Dim intCount As Integer

Set db = CurrentDb
Set rstUser = db.OpenRecordset("AppUsers", dbOpenDynaset)
intCount = 0
Do While Not rstUser.EOF
   If rstUser!User_Name = Me!txtUser Then
       rstUser.Delete
       intCount = intCount + 1
   End If
   rstUser.MoveNext
Loop

End Sub
------------------------------------------------
Private Sub CmdNewRec_Click()

   Dim db As Database
   Dim rstUser As Recordset
   Dim rstPass As Recordset
   Dim rstSec As Recordset
   
   Set db = CurrentDb()
   Set rstUser = db.OpenRecordset("AppUsers", dbOpenDynaset)
   With rstUser
       .AddNew
       ![User_Name] = Me!txtUser
       ![User_Password] = Me!txtPass
       ![Sec_Level_ID] = cboSec
       .Update
   End With
   

End Sub
-------------------------------------------------
Private Sub CmdExit_Click()

   DoCmd.OpenForm "OBR_Resources"
   DoCmd.Close acForm, "FrmUsers"
   
End Sub
Rob Oldfield - 13 Dec 2005 02:28 GMT
Two points:

On the question as you post it - if it's adding a duplicate record the
second time that you open it then it's down to how you are doing that, and
not because of code in the form itself.  You'd need to post the code that is
opening the form to get any help.

On what you're trying to do via this form - it's completely pointless.  Even
if you get your code completely successful, then you have *NO* security.
This is the way to go:
http://support.microsoft.com/default.aspx?scid=kb;en-us;207793 - complicated
but, if you want any level of security, necessary.

> I have a form that has three feilds, one being a drop down menu that are used
> to add a user, password, and security level to a database. When you open the
[quoted text clipped - 53 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.