S
SharynInCambodia
I have been trying to create a series of forms that open up from a main form
(related like a subform but opening as a new form instead). Using the
IsLoaded code, i have managed to allow forms to be completed that
automatically enter in the foreign key / primary key linking the two forms.
I also would like to be able to filter records in the secondary form when
opened from the main form (based on the main form ID) so that i am only
viewing the related records. I have tried suggested code but it is not
working. This is what i have been trying in the main form (as suggested)
Private Sub Form_Current()
' Declare and set a variable to store the WHERE
' clause that describes the records you want to
' display.
Dim strCond As String
strCond = "MainTableID = Forms![Phase3-VProbAnalysis2]!ID"
' Use the IsLoaded function from the Northwind
' sample database to check whether the Products
' form is open, then set the properties.
If IsLoaded("Gen-InterestGroups") Then
Forms![Gen-InterestGroups].FilterOn = True
Forms![Gen-InterestGroups].Filter = strCond
End If
End Sub
The IsLoaded code has been defined in the module section of the DB as copied
from Northwind and that works for the other usage (automatically entering the
foreign key into the records on the secondary form).
Any ideas why this isn't working? Thanks
(related like a subform but opening as a new form instead). Using the
IsLoaded code, i have managed to allow forms to be completed that
automatically enter in the foreign key / primary key linking the two forms.
I also would like to be able to filter records in the secondary form when
opened from the main form (based on the main form ID) so that i am only
viewing the related records. I have tried suggested code but it is not
working. This is what i have been trying in the main form (as suggested)
Private Sub Form_Current()
' Declare and set a variable to store the WHERE
' clause that describes the records you want to
' display.
Dim strCond As String
strCond = "MainTableID = Forms![Phase3-VProbAnalysis2]!ID"
' Use the IsLoaded function from the Northwind
' sample database to check whether the Products
' form is open, then set the properties.
If IsLoaded("Gen-InterestGroups") Then
Forms![Gen-InterestGroups].FilterOn = True
Forms![Gen-InterestGroups].Filter = strCond
End If
End Sub
The IsLoaded code has been defined in the module section of the DB as copied
from Northwind and that works for the other usage (automatically entering the
foreign key into the records on the secondary form).
Any ideas why this isn't working? Thanks