kevinh2320
Board Regular
- Joined
- May 13, 2016
- Messages
- 61
In Access I have a form called f-search-records-by-FTFN (directly below). The "Enter FTFN" field (Name = FTFN_Search) has the code shown below which is triggered on "After Update". So if a user opens the form and enters a filetype/filenumber and either presses Tab or Enter the code runs and the record is loaded into the form. If the user then clicks the "Append Record to Paid Accounts" button that record is appended to the t-paid-accounts table. That's the complete operation.
However, the problem is this. If a user opens the form and clicks the "Append Record to Paid Accounts" without entering a filetype/filenumber into the "Enter FTFN" all of the records in the underlying query are appended to the t-paid-accounts table. (Bad - definitely not what I want to happen)
I want to modify my code to disable the "Appened Record to Paid Accounts" command button on form load. Then re-enable it once the user has entered and filetype/filenumber in the "Enter FTFN" field and pressed Tab or Enter.
Option Compare Database
Private Sub Append_to_t_paid_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "q-append-record-TO-t-paid-accounts"
DoCmd.Close acForm, "f-search-records-by-FTFN"
DoCmd.OpenForm "f-paid-accounts", acNormal, acDialog
DoCmd.RunCommand acCmdRecordsGoToLast
Example of form when one account is enter and correctly loaded.
Hope this make sense and thank you for any help!
However, the problem is this. If a user opens the form and clicks the "Append Record to Paid Accounts" without entering a filetype/filenumber into the "Enter FTFN" all of the records in the underlying query are appended to the t-paid-accounts table. (Bad - definitely not what I want to happen)
I want to modify my code to disable the "Appened Record to Paid Accounts" command button on form load. Then re-enable it once the user has entered and filetype/filenumber in the "Enter FTFN" field and pressed Tab or Enter.
Option Compare Database
Private Sub Append_to_t_paid_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "q-append-record-TO-t-paid-accounts"
DoCmd.Close acForm, "f-search-records-by-FTFN"
DoCmd.OpenForm "f-paid-accounts", acNormal, acDialog
DoCmd.RunCommand acCmdRecordsGoToLast
Example of form when one account is enter and correctly loaded.
Hope this make sense and thank you for any help!