Hello
Hoping someone may have time to look at the following...
I have a subform (SubFrm_Warnings) which I need to appear according to which company record is open on the form...
I have used OpenArgs on the DoCmd.OpenForm to set the companyref / ID number - this is working OK. I have now realised that although the correct company ID is now being set, the actually text box which contains any warnings is not linking to that company ID?
I know I must have to link this somehow... please could someone give me a clue as to which is the best approach...
The forms involved are Frm_Search (where the DoCmd.OpenForm is); Frm_Company (which is the main form which includes all the company info) and SubFrm_Warnings (which is to appear on open of the Company form should there be any warnings for that particular company.
I have attached the database and posted the relevant code below...
This code is on Frm_Search
Sub OpenCompanyForm()
'open the form
DoCmd.OpenForm "Frm_Company"
'run the Public GoToContact method, passing in the ContactRef selected in the list
Forms("Frm_Company").GoToContact Me.ListCompany
Dim stDocName As String
Dim intArgs
Dim stLinkCriteria As String
intArgs = Forms!Frm_Company.txtCompanyID
stDocName = "SubFrm_Warnings"
If Not IsNull(intArgs) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , intArgs
End If
'and close the search form
DoCmd.Close acForm, Me.Name
End Sub
This code is on SubFrm_Warnings
Private Sub Form_Load()
Me.txtCompanyRef = Me.OpenArgs
End Sub
Hoping someone may have time to look at the following...
I have a subform (SubFrm_Warnings) which I need to appear according to which company record is open on the form...
I have used OpenArgs on the DoCmd.OpenForm to set the companyref / ID number - this is working OK. I have now realised that although the correct company ID is now being set, the actually text box which contains any warnings is not linking to that company ID?
I know I must have to link this somehow... please could someone give me a clue as to which is the best approach...
The forms involved are Frm_Search (where the DoCmd.OpenForm is); Frm_Company (which is the main form which includes all the company info) and SubFrm_Warnings (which is to appear on open of the Company form should there be any warnings for that particular company.
I have attached the database and posted the relevant code below...
This code is on Frm_Search
Sub OpenCompanyForm()
'open the form
DoCmd.OpenForm "Frm_Company"
'run the Public GoToContact method, passing in the ContactRef selected in the list
Forms("Frm_Company").GoToContact Me.ListCompany
Dim stDocName As String
Dim intArgs
Dim stLinkCriteria As String
intArgs = Forms!Frm_Company.txtCompanyID
stDocName = "SubFrm_Warnings"
If Not IsNull(intArgs) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , intArgs
End If
'and close the search form
DoCmd.Close acForm, Me.Name
End Sub
This code is on SubFrm_Warnings
Private Sub Form_Load()
Me.txtCompanyRef = Me.OpenArgs
End Sub