UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Error 2585, Access 2016    
 
   
ordnance1
post Apr 4 2020, 06:15 PM
Post#1



Posts: 768
Joined: 7-May 11



I have a form frm_Bank that opens as a model popup form. When the code below runs I get the following error:

Run-time error "2585";
This action can't be carried out while processing a form ot report event

but if I click on the close button on the form it closes without error.

CODE
Private Sub txt_Bank_Name_Enter()
    'Test that a bank has been selected
        If IsNull(TempVars!Bank_ID) Then
            MsgBox "You have not selected a bank to edit." & vbCrLf & " " & vbCrLf & _
            "If the Bank is not listed, you must create it first.", vbCritical
                DoCmd.Close acForm, "frm_Bank", acSaveNo
        End If
End Sub
Go to the top of the page
 
ordnance1
post Apr 4 2020, 06:31 PM
Post#2



Posts: 768
Joined: 7-May 11



Found a solution.

Put my code in a Dirty event and added cancel = true

CODE
Private Sub txt_Bank_Name_Dirty(Cancel As Integer)
        If IsNull(TempVars!Bank_ID) Then
            MsgBox "You have not selected a bank to edit." & vbCrLf & " " & vbCrLf & _
            "If the Bank is not listed, you must create it first.", vbCritical
Cancel = True
DoCmd.Close
        End If
End Sub

Go to the top of the page
 
tina t
post Apr 4 2020, 09:51 PM
Post#3



Posts: 6,601
Joined: 11-November 10
From: SoCal, USA


why not test for a value in TempVars!Bank_ID before you open the form?

hth
tina
This post has been edited by tina t: Apr 4 2020, 09:52 PM

--------------------
"the wheel never stops turning"
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    30th May 2020 - 10:57 AM