J
John Ortt
I am trying to create a drill-down query. I have an order summary sheet
which sums all the orders for a particular customer by month. When the user
double clicks on a field I would like to open the detail report for the
record they have clicked on. The problem is the form I am using is already
used from another report so I would rather use code to create the link
rather than put it in the form or the query.
The following code is opening the form but it is not applying the filter.
If anybody has any ideas why I would be very grateful.
Thankyou,
John
--------------------------------------------------------
Private Sub TYPE_DblClick(Cancel As Integer)
Link
End Sub
Function Link()
Dim stDocName As String
Dim stLinkCriteria As String
Dim stLinkCriteria1 As String
Dim stLinkCriteria2 As String
Dim stLinkCriteria3 As String
Dim stLinkCriteria4 As String
stDocName = "VendorExpectedMarginsReport"
DoCmd.Openform stDocName, , stLinkCriteria
RecordSource = "VendorMarginsDDQuery"
stLinkCriteria1 = "[TYPE]=" & "'" & Me![TYPE] & "'"
stLinkCriteria2 = "[IPT]=" & "'" & Me![IPT] & "'"
stLinkCriteria3 = "[CUSTOMER_2]=" & "'" & Me![CUSTOMER_2] & "'"
stLinkCriteria4 = "[SD Forecast]=" & "'" & Me![SD Forecast] & "'"
stLinkCriteria = stLinkCriteria1 & " and " & stLinkCriteria2 & " and " &
stLinkCriteria3 & " and " & stLinkCriteria4
End Function
which sums all the orders for a particular customer by month. When the user
double clicks on a field I would like to open the detail report for the
record they have clicked on. The problem is the form I am using is already
used from another report so I would rather use code to create the link
rather than put it in the form or the query.
The following code is opening the form but it is not applying the filter.
If anybody has any ideas why I would be very grateful.
Thankyou,
John
--------------------------------------------------------
Private Sub TYPE_DblClick(Cancel As Integer)
Link
End Sub
Function Link()
Dim stDocName As String
Dim stLinkCriteria As String
Dim stLinkCriteria1 As String
Dim stLinkCriteria2 As String
Dim stLinkCriteria3 As String
Dim stLinkCriteria4 As String
stDocName = "VendorExpectedMarginsReport"
DoCmd.Openform stDocName, , stLinkCriteria
RecordSource = "VendorMarginsDDQuery"
stLinkCriteria1 = "[TYPE]=" & "'" & Me![TYPE] & "'"
stLinkCriteria2 = "[IPT]=" & "'" & Me![IPT] & "'"
stLinkCriteria3 = "[CUSTOMER_2]=" & "'" & Me![CUSTOMER_2] & "'"
stLinkCriteria4 = "[SD Forecast]=" & "'" & Me![SD Forecast] & "'"
stLinkCriteria = stLinkCriteria1 & " and " & stLinkCriteria2 & " and " &
stLinkCriteria3 & " and " & stLinkCriteria4
End Function