I have to synchronize a form and a subform on more than one criteria.
I use the code below which was in the " northwind database sample " provided with Access and I modified it for my purpose.
This sample code is based on an unique criteria. I need to synchronize on 3 fields(or 3 criterias). I suppose I will need 2 additionnal variables (SynCriteria1 and SynCriteria2). If I need 2 more variables, I suppose I have to modify the line "DoCmd.OpenForm strDocName,,,SynCriteria" to add theses variables but I don't know how to do that.
Private Sub MySub_DblClick(Cancel As Integer)
Dim strDocName As String, SynCriteria As String
Dim SynCriteria1 As String, Dim SynCriteria2 As String
If IsNull(Me![MyField]) Then
Exit Sub
Else
strDocName = "MySubform"
SynCriteria = "[MyField] = forms![MyForm]![MyField]"
SynCriteria1 = "[MyField1] = forms![MyForm]![MyField1]"
SynCriteria2= "[MyField2] = forms![MyForm]![MyField2]"
DoCmd.OpenForm strNomDoc, , , SynCriteria ???and here I am not able to complete...
End If
End Sub
I use the code below which was in the " northwind database sample " provided with Access and I modified it for my purpose.
This sample code is based on an unique criteria. I need to synchronize on 3 fields(or 3 criterias). I suppose I will need 2 additionnal variables (SynCriteria1 and SynCriteria2). If I need 2 more variables, I suppose I have to modify the line "DoCmd.OpenForm strDocName,,,SynCriteria" to add theses variables but I don't know how to do that.
Private Sub MySub_DblClick(Cancel As Integer)
Dim strDocName As String, SynCriteria As String
Dim SynCriteria1 As String, Dim SynCriteria2 As String
If IsNull(Me![MyField]) Then
Exit Sub
Else
strDocName = "MySubform"
SynCriteria = "[MyField] = forms![MyForm]![MyField]"
SynCriteria1 = "[MyField1] = forms![MyForm]![MyField1]"
SynCriteria2= "[MyField2] = forms![MyForm]![MyField2]"
DoCmd.OpenForm strNomDoc, , , SynCriteria ???and here I am not able to complete...
End If
End Sub