A family of Microsoft relational database management systems designed for ease of use.
Open form two different ways
Hello,
I have a form called "frm_Data Entry".
I acess this form via two command buttons on a different form. One of the two buttons I use to add a new record with the below code, all good...
Private Sub AddBrother_Click()
On Error GoTo Err_AddBrother_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_Data Entry"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
'DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_AddBrother_Click:
Exit Sub
Err_AddBrother_Click:
MsgBox Err.Description
Resume Exit_AddBrother_Click
End Sub
However, if I use the above button which runs the "acFormAdd" code, it changes the form so that the form always opens in Add mode.
Now when I click the other button (see below code) to open the same form, the form continues to opens in add mode, but I need the form to open in a mode that opens the form with the same record as in the previous form. How can i fix the below code and possibly the above code that each button does what it is supposed to every time? Can you help me with this?
Private Sub MemberDetails_Click()
On Error GoTo Err_MemberDetails_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_Data Entry"
stLinkCriteria = "[UniqueID]=" & Me![UniqueID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_MemberDetails_Click:
Exit Sub
Err_MemberDetails_Click:
MsgBox Err.Description
Resume Exit_MemberDetails_Click
End Sub
Iram/mcp
Microsoft 365 and Office | Access | For home | Windows
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.