Results 1 to 2 of 2
2010-01-17, 07:59 #1
- Join Date
- May 2002
- Jerusalem, Israel
- Thanked 0 Times in 0 Posts
I have two forms: Main Form and KAF.
On both of these forms I have the following fields: P and Country.
KAF also has a checkbox (called KAF).
The Main form is a continuous form, so I can't use a subform to show whether or not the checkbox for the corresponding record in KAF is checked.
My idea was to display a label in the Main Form ONLY when the corresponding record in KAF has the checkbox checked. The thing is, BOTH of the fields (P and Country) need to match the record in the KAF form.
I thought that what I could do is to make KAF open as a hidden form when the Main Form opens and then filter KAF so that it displays the record corresponding to the record on the Main Form that has the focus. Then I would need to run code like this to filter the hidden KAF form to match the current record in the Main Form:
Dim stDocName As String Dim stLinkCriteria As String stDocName = "frm_KAF" stLinkCriteria = "[P]& [Country]=" & "'" & Me![P] & [Country] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria
If Forms!frm_KAF.KAF = True Then Me.KAFLabel.visible = True Else Me.KAFLabel.visible=False End If
2. This feels like a very round-about way to do this - is there an easier way?
2010-01-17, 09:59 #2
- Join Date
- Aug 2001
- Evergreen, CO, USA
- Thanked 64 Times in 63 Posts
Why not use a similar data source for both forms? Create an expression something like this for the main form:
KAFTrue: IIF([KAF],"Text for the pseudo label goes here",Null)
Assuming you do want to take the approach you attempted, you should be able to use the OnCurrent event to do the filtering and turn the KAFLabel on and off, although you may encounter timing issues and need to do some Refreshes or Requeries.Wendell