I have a form that is reloaded as in edit mode with one button and in nonediting mode with another. But to avoid trouble with null values (in case the user has erased the value he was editing) I need to filter the exiteditmodebutton command:
Private Sub ExtEditMode_Click()
On Error GoTo Err_ExtEditMode_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Products"
Dim f As Form
If IsNull([ProductId]) Then
stLinkCriteria = "[ProductId]"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
Else
DoCmd.OpenForm stDocName, , , , acFormReadOnly
End If
MsgBox "Read Only Mode Activated"
Set f = Forms(stDocName)
f.MkProduct.Visible = False
f.Bij17.Visible = False
f.SvProduct.Visible = False
f.Bij18.Visible = False
f.DltProduct.Visible = False
f.Bij19.Visible = False
Exit_ExtEditMode_Click:
Exit Sub
Err_ExtEditMode_Click:
MsgBox Err.Description
Resume Exit_ExtEditMode_Click
End Sub
This is my code. I just need to know how to change the link criteria apropriately, so that it shows all the good records again.
Help, pls!
Private Sub ExtEditMode_Click()
On Error GoTo Err_ExtEditMode_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Products"
Dim f As Form
If IsNull([ProductId]) Then
stLinkCriteria = "[ProductId]"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
Else
DoCmd.OpenForm stDocName, , , , acFormReadOnly
End If
MsgBox "Read Only Mode Activated"
Set f = Forms(stDocName)
f.MkProduct.Visible = False
f.Bij17.Visible = False
f.SvProduct.Visible = False
f.Bij18.Visible = False
f.DltProduct.Visible = False
f.Bij19.Visible = False
Exit_ExtEditMode_Click:
Exit Sub
Err_ExtEditMode_Click:
MsgBox Err.Description
Resume Exit_ExtEditMode_Click
End Sub
This is my code. I just need to know how to change the link criteria apropriately, so that it shows all the good records again.
Help, pls!