Results 1 to 3 of 3
  1. #1
    vad77 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Location
    USA
    Posts
    101

    Access crashing when using a command button

    I am new to this forum and I am lookng for help with one of my db.
    I created a database to keep track and update my usernames and passwords.
    It is made of up a 1 table and a couple of queries and forms.
    I have a couple of buttons with the code shown below. If I were to click on a button it perform the correct function.
    If I were to click another button in the same record Access crashes. The crash could happen the first time I click a button
    or on the second button I click.
    Don't know if I have a problem with my code or if I have a bad install of Access.

    ** This rotates the passwords in the record**

    Private Sub Command34_Click()
    Me.PreviousPassword = Me.CurrentPassword


    Me.CurrentPassword = Me.Password1
    Me.Password1 = Me.Password2
    Me.Password2 = Me.Password3
    Me.Password3 = Me.Password4
    Me.Password4 = Me.Password5
    Me.Password5 = Me.Password6
    Me.Password6 = Me.PreviousPassword
    Me.PreviousDate = Me.DateChanged
    Me.DateChanged = Date
    End Sub

    ---------------------

    This code I use to be able to copy the password and paste it to what ever I am logging on too. I also have a button to copy the username.

    Private Sub Command37_Click()
    Me.CurrentPassword.SetFocus
    DoCmd.RunCommand acCmdCopy
    End Sub

    Is there anything wrong with my code or is there a better way?
    Thanks in adavance for your response

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    That code structure will cause loss of CurrentPassword and duplication of passwords. Try:

    Private Sub Command18_Click()
    Dim PrePW As String
    PrePW = Me.PreviousPassword
    Me.PreviousPassword = Me.CurrentPassword
    Me.CurrentPassword = Me.Password1
    Me.Password1 = Me.Password2
    Me.Password2 = Me.Password3
    Me.Password3 = Me.Password4
    Me.Password4 = Me.Password5
    Me.Password5 = Me.Password6
    Me.Password6 = PrePW
    Me.PreviousDate = Me.DateChanged
    Me.DateChanged = Date
    End Sub


    I don't know why the crash, I would have to analyze your db. If you want to provide, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Be aware that this is double-posted here

    http://www.dbforums.com/microsoft-ac...mmand-btn.html

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Print Preview Command Button Locks Access
    By DanKoz in forum Access
    Replies: 7
    Last Post: 03-19-2018, 12:34 PM
  2. Replies: 12
    Last Post: 10-20-2014, 11:22 AM
  3. Replies: 3
    Last Post: 08-04-2013, 07:11 AM
  4. add toolbar command button to access form?
    By markjkubicki in forum Forms
    Replies: 1
    Last Post: 01-26-2012, 07:11 PM
  5. Replies: 1
    Last Post: 07-27-2010, 02:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums