Hello,
I think I'm nearly there on a piece of code to open a form. The code below which I harvested, does allow me to open the relevant form based on the support type i choose, however I am trying then to populate the linked field [SupportID] from the first form. The problem is the form could be any one of 5 so the only name i have in the code is strForm and i can't get it to work.
Any ideas? Thanks
Private Sub CmdCreateForm_Click()
Dim strForm As String
If Me.SupportType = "3" Then
strForm = "frmProjects"
ElseIf Me.SupportType = "1" Then
strForm = "frmRemedials"
ElseIf Me.SupportType = "5" Then
strForm = "frmReclamations"
ElseIf Me.SupportType = "2" Then
strForm = "frmUValue"
ElseIf Me.SupportType = "4" Then
strForm = "frmSiteVisits"
Else
strForm = "frmCustomers"
End If
DoCmd.OpenForm strForm, acNormal, "", "SupportID= " & Me.SupportID, acFormAdd
strForm![SupportID] = Me.SupportID
End Sub
I think I'm nearly there on a piece of code to open a form. The code below which I harvested, does allow me to open the relevant form based on the support type i choose, however I am trying then to populate the linked field [SupportID] from the first form. The problem is the form could be any one of 5 so the only name i have in the code is strForm and i can't get it to work.
Any ideas? Thanks
Private Sub CmdCreateForm_Click()
Dim strForm As String
If Me.SupportType = "3" Then
strForm = "frmProjects"
ElseIf Me.SupportType = "1" Then
strForm = "frmRemedials"
ElseIf Me.SupportType = "5" Then
strForm = "frmReclamations"
ElseIf Me.SupportType = "2" Then
strForm = "frmUValue"
ElseIf Me.SupportType = "4" Then
strForm = "frmSiteVisits"
Else
strForm = "frmCustomers"
End If
DoCmd.OpenForm strForm, acNormal, "", "SupportID= " & Me.SupportID, acFormAdd
strForm![SupportID] = Me.SupportID
End Sub