J
John Ortt
This post is a follow-on from my previous post entitled: Help with a filter
when opening a form
Katrina has been a great help and put me on the right track but I am unable
to find the problem dispite her help.
I have a summary form which gives the total value of sales for the month.
When the user clicks on a record it opens another form which In want to
display the detail records for that month.
The problem centres around the fact that I am trying to set the source data
for the Detail table in the code on the summary report. This is because I
use the same form design for lots of queries but all the others are less
complex than this one.
The code breaks at the following point:
DoCmd.Openform stDocName, "VendorMarginsDDQuery", stLinkCriteria
The form opens if I remove the "VendorMarginsDDQuery" section, which makes
me believe that it is the assigning of the source data which is causing
problems.
I have tried all of Katrina's suggestions with the following results:
1. All fields do contain data of some sort.
2. No fields are numeric - so the "'" text qualifier is OK
3. All of the fields used are included in the recordset
Thankyou for your time,
John.
I have posted my code below for further reference:
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
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"
'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
DoCmd.Openform stDocName, "VendorMarginsDDQuery", stLinkCriteria
End Function
when opening a form
Katrina has been a great help and put me on the right track but I am unable
to find the problem dispite her help.
I have a summary form which gives the total value of sales for the month.
When the user clicks on a record it opens another form which In want to
display the detail records for that month.
The problem centres around the fact that I am trying to set the source data
for the Detail table in the code on the summary report. This is because I
use the same form design for lots of queries but all the others are less
complex than this one.
The code breaks at the following point:
DoCmd.Openform stDocName, "VendorMarginsDDQuery", stLinkCriteria
The form opens if I remove the "VendorMarginsDDQuery" section, which makes
me believe that it is the assigning of the source data which is causing
problems.
I have tried all of Katrina's suggestions with the following results:
1. All fields do contain data of some sort.
2. No fields are numeric - so the "'" text qualifier is OK
3. All of the fields used are included in the recordset
Thankyou for your time,
John.
I have posted my code below for further reference:
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
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"
'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
DoCmd.Openform stDocName, "VendorMarginsDDQuery", stLinkCriteria
End Function