Disabling the Save Button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abhean
    New Member
    • Mar 2019
    • 32

    #1

    Disabling the Save Button

    Working on a record check and all seems to work as I expected until I attempted to disable one of my buttons on the form. Now, none of the pulled information shows on the form as it did prior to the introduction of
    Code:
    Me.ClientFullSaveBtn.Enabled = False
    . Thoughts or suggestions?

    Code:
    Private Sub CAccountTxt_AfterUpdate()
    Dim db      As DAO.Database
    Dim rst     As DAO.Recordset
    Set db = CurrentDb()
    Set rst = db.OpenRecordset("ClientTbl", dbOpenDynaset)
    
        With rst
               If Not (.BOF And .EOF) Then
                   Call .MoveFirst
                   .FindFirst "CAccount = '" & Me.CAccountTxt & "'"
                   If Not .NoMatch Then
                       'Found it Set all the fields!
                       Me.CStartDate = !CStartDate
                       Me.CClientName = !CClientName
                       Me.CAddress1 = !CAddress1
                       Me.CAddress2 = !CAddress2
                       Me.CZip = !CZip
                       Me.CPhone = !CPhone
                       Me.CFax = !CFax
                       Me.CTimeZone = !CTimeZone
                       Me.CEmail = !CEmail
                       Me.CHours = !CHours
                       Me.CSales = !CSales
                       Me.CCollectionFld = !CCollectionFld
                       Me.CShippingFld = !CShippingFld
                       'Close Save record BTN
                       Me.ClientFullSaveBtn.Enabled = False
                       
                   Else
                        'Didnt Find Record
                        
                    End If
               End If
               Call .Close
           End With
           
    Call db.Close
    Set rst = Nothing
    Set db = Nothing
    End Sub
  • isladogs
    Recognized Expert Moderator Contributor
    • Jul 2007
    • 483

    #2
    First of all, why are you using an unbound form?
    Secondly why disable the Save button on an unbound form?

    Thirdly, if you must do this, try adding DoEvents just before the line disabling the button

    Comment

    • Abhean
      New Member
      • Mar 2019
      • 32

      #3
      This was me playing and testing some ideas. Simply wondering why the result was happening the way it was. Thank you for the response.

      Comment

      Working...