Hi all,
I've designed a form in access and want to use it multiple times in Access otherwise I would have to create the same form at least 4/5 times so I would like to do is when the control/button to open the form is used, it applies different controls about what can be done.
For example, the form when used as standard is a data entry form that is used to upload the data to SQL where it is stored. What I then wish to do is use it as read only details form. I.e, once the user is looking at the details for the person, they can not edit the details in any way.
I've been using the example below, I've trimmed it down and am testing it using just one command for the time being. Once I understand how it works, I can then apply it to the other different commands I have.
I'm sure I'm applying things in either the wrong order or missing something in the code completely. Any help would be much appreciated as it would save me creating the form many times.
Thanks.
I've designed a form in access and want to use it multiple times in Access otherwise I would have to create the same form at least 4/5 times so I would like to do is when the control/button to open the form is used, it applies different controls about what can be done.
For example, the form when used as standard is a data entry form that is used to upload the data to SQL where it is stored. What I then wish to do is use it as read only details form. I.e, once the user is looking at the details for the person, they can not edit the details in any way.
I've been using the example below, I've trimmed it down and am testing it using just one command for the time being. Once I understand how it works, I can then apply it to the other different commands I have.
Code:
Private Sub ID_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmadd_new_contact"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Me!Titleaddnewcontact.Visible = False
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End Sub
I'm sure I'm applying things in either the wrong order or missing something in the code completely. Any help would be much appreciated as it would save me creating the form many times.
Thanks.