DataEntry Property with a twist

craw

Registered User.
Local time
Today, 04:03
Joined
Sep 24, 2003
Messages
50
I have the following code. My delimma occurs because the form i'm opening, frm_ToolGeneralInformation, is used in my database to add new records, hence, I have set the data entry property to yes. I'm wanting to use this same form to update information on the Tool deleted in the subform, and to do this, I need to change the dataentry property to false (or no). When I run this code, I get an error that Access can not find the form frm_ToolGeneralInformation

PHP:
Private Sub Form_Delete(Cancel As Integer)Private Sub Form_Delete(Cancel As Integer)

Dim stDocName As String
Dim stLinkCriteria As String
Dim strMsg As String

Forms!frm_ToolGeneralInformation.DataEntry = False

strMsg = "Update the Tool Information form"

Beep
    If MsgBox(strMsg, vbExclamation + vbOKOnly, "Tool Database") = vbOK Then
        stDocName = "frm_ToolGeneralInformation"
        DoCmd.OpenForm stDocName, , , "[Tool] = Forms!frm_Tool!sfrm_CToolInfo!Tool"
        
    End If
 
End Sub

Any help would be appreciated!:D
 
What class module is the Form_Delete Event located in?

From the look of your code frm_ToolGeneralInformation is already opened.
 
It is in a subform called sfrm_CToolInfo which in on the form frm_Tool.

Actually my frm_ToolGeneralInformation is not open, so I moved the command to change the data entry property after the docmd.openform statement. The problem with this is, the property changes but the filter set in the docmd statement doesn't work.

PHP:
Beep
    If MsgBox(strMsg, vbExclamation + vbOKOnly, "Tool Database") = vbOK Then
        stDocName = "frm_ToolGeneralInformation"
        DoCmd.OpenForm stDocName, , , "[Tool] = Forms!frm_Tool!sfrm_CToolInfo!Tool"
        Forms!frm_ToolGeneralInformation.DataEntry = False
    End If
 
End Sub
 
by golly, i've got it.

I put in a docmd open form and set the dataentry property = false before the If statement.
 

Users who are viewing this thread

Back
Top Bottom