Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Asking for parameters on a report,the fields are deleted from report

Status
Not open for further replies.

MsMope

IS-IT--Management
Sep 3, 2003
83
US
Good Morning/Afternoon,
I have a report [api_rptJobQuote] that I have made some modifications to, this report is generated from a query, I have removed fields from the report, however at run-time I am asked for the parameters of these two non-existant table fields, I have checked the vba code behind, but there is no reference to these fields. The query runs fine and builds the table correctly, so I must be missing something any suggestions?

Code:
[i]Fields are [b]DEL140 and DEL220[/B][/I]
Private Sub GroupFooter3_Format(Cancel As Integer, FormatCount As Integer)
Dim var, Filter$
Dim PRICE(1 To 8), Caption(1 To 8), Pricing As String
Dim TrussPrice, HangerPrice, EngLumbPrice

SQL$ = "SELECT user_tblJobProp.ID, Child_Class, "
SQL$ = SQL$ & "Sum(user_tblJobChild.Cost*user_tblJobChild.Quantity) AS SumCost, "
SQL$ = SQL$ & "Sum(user_tblJobChild.Extra_Cost) AS ExtraCost, "
SQL$ = SQL$ & "Sum(user_tblJobChild.List_Price*user_tblJobChild.Quantity) AS ListPrice, "
SQL$ = SQL$ & "Sum(user_tblJobChild.Net_Price*user_tblJobChild.Quantity) AS NetPrice "
SQL$ = SQL$ & "FROM user_tblJobProp INNER JOIN user_tblJobChild ON user_tblJobProp.ID = "
SQL$ = SQL$ & "user_tblJobChild.Parent_ID "
SQL$ = SQL$ & "Where (((user_tblJobProp.ID) = is_modItem_GetCurrentID())) "
SQL$ = SQL$ & "GROUP BY user_tblJobProp.ID, user_tblJobChild.Child_Class;"

SQL$ = SQL$
Set db = CurrentDb
Set rs = db.OpenRecordset(SQL$)

'Check to see if it is a price job to select proper prices
TrussPrice = 0
EngLumbPrice = 0
HangerPrice = 0

var = DCount("[Child_Class]", "api_qryCostSplit")
rs.MoveLast
If rs.[Child_Class] = "TRUSS" Then
    Filter$ = "Truss"
Else
    Filter$ = "Book_Truss"
End If
rs.MoveFirst
For X = 1 To var
    Caption(X) = rs.[Child_Class]
        PRICE(X) = rs.ListPrice
        If Caption(X) = "Truss" Or Caption(X) = "Pre_Eng_Truss" Or Caption(X) = "Stock_Truss" Or Caption(X) = "Extra" Or Caption(X) = "Lumber" Then
            TrussPrice = TrussPrice + PRICE(X)
        ElseIf Caption(X) = "LVL" Or Caption(X) = "I_Joist" Or Caption(X) = "Eng_Lbr" Then
            EngLumbPrice = EngLumbPrice + PRICE(X)
        ElseIf Caption(X) = "Hanger" Then
            'HangerPrice = HangerPrice = Price(X)
            HangerPrice = PRICE(X)
        End If
'    Else
'        Price(X) = rs.NetPrice
'        If Caption(X) = Filter$ Or Caption(X) = "Pre_Eng_Truss" Or Caption(X) = "Stock_Truss" Then
'            TrussPrice = TrussPrice + Price(X)
'        ElseIf Caption(X) = "LVL" Or Caption(X) = "I_Joist" Or Caption(X) = "Microlam" Then
'            EngLumbPrice = EngLumbPrice + Price(X)
'        ElseIf Caption(X) = "Hanger" Then
'            HangerPrice = HangerPrice + Price(X)
'        End If
'    End If
    rs.MoveNext
Next

If Hanger = -1 Then
        SQL$ = "SELECT Sum(api_qryHangerSchedule.ExtPrice) AS ExtPriceT FROM api_qryHangerSchedule"

        Set db1 = CurrentDb
        Set rs1 = db1.OpenRecordset(SQL$)
        HangerPrice = HangerPrice + rs1.ExtPriceT
End If

Me.SubTruss = TrussPrice
Me.SubHanger = HangerPrice
Me.SubEngLumber = EngLumbPrice

End Sub

Private Sub Report_Open(Cancel As Integer)
    If is_modObject_Exists("api_tblTmpJobQuote") Then
            DoCmd.DeleteObject acTable, "api_tblTmpJobQuote"
    End If
    
    DoCmd.OpenQuery "api_qryJobQuote"
    DoCmd.OpenQuery "api_qryJobQuote_hangers"
    DoCmd.ApplyFilter , "[Job Child Class] <> 'Book_Truss'"
End Sub

 
I recieved an answer from the VBA coding forum on this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top