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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help SQL 1

Status
Not open for further replies.

false420

Programmer
Mar 31, 2005
87
US
I was hoping someone could help me with a few SQL statements. The only statements that seems to be giving problems is the MOBILE statements. all of the others work perfect. ive tried to mirror the Mobile statements after the others but it still doesnt seem to work , i keep getting:

Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

ODBC driver does not support the requested properties.

/detailed_cc_date.asp, line 268

And line 268 points to where i open the recordset.

Dim strDetailedInfo
'See if user was sent from search page. If so, select based on the user's selection(s).
If (Option_CostCenter = "" AND Option_Carrier = "" AND Option_Account = "") Then
If Option_Service = "Mobile" Then
If (Not(Option_FirstDropdown = "")) AND (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, Long_Date, Carrier, Account, Mobile, Owner_Name, Mobile.Cost_Center, " & GLholder & "Location, Plan, Total_Used, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Mobile WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Mobile = '" & Option_SecondDropdown & "' AND Owner_Name = '" & Option_FirstDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, Long_Date, Carrier, Account, Mobile, Owner_Name, Mobile.Cost_Center, " & GLholder & "Location, Plan, Total_Used, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Mobile WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Mobile = '" & Option_SecondDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_FirstDropdown = "")) Then
strDetailedInfo = "SELECT ID, Long_Date, Carrier, Account, Mobile, Owner_Name, Mobile.Cost_Center, " & GLholder & "Location, Plan, Total_Used, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Mobile WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Owner_Name = '" & Option_FirstDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
Else
strDetailedInfo = "SELECT ID, Long_Date, Carrier, Account, Mobile, Owner_Name, Mobile.Cost_Center, " & GLholder & "Location, Plan, Total_Used, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Mobile WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
End If

ElseIf Option_Service = "Local" Then
If (Not(Option_FirstDropdown = "")) AND (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, Local.Cost_Center, Long_Date, Carrier, Account, Earning_No, Charge, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Local WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Earning_No = '" & Option_SecondDropdown & "' AND Account = '" & Option_FirstDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, Local.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Earning_No, Charge, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Local WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Earning_No = '" & Option_SecondDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_FirstDropdown = "")) Then
strDetailedInfo = "SELECT ID, Local.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Earning_No, Charge, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Local WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Account = '" & Option_FirstDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
Else
strDetailedInfo = "SELECT ID, Local.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Earning_No, Charge, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Local WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
End If
ElseIf Option_Service = "LD" Then
If (Not(Option_FirstDropdown = "")) AND (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, LD.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Subaccount, Location, Usage, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, LD WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Location = '" & Option_SecondDropdown & "' AND Account = '" & Option_FirstDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, LD.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Subaccount, Location, Usage, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, LD WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND (Location = '" & Option_SecondDropdown & "' OR Location LIKE '%" & Option_SecondDropdown & "%') AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_FirstDropdown = "")) Then
strDetailedInfo = "SELECT ID, LD.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Subaccount, Location, Usage, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, LD WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Account = '" & Option_FirstDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
Else
strDetailedInfo = "SELECT ID, LD.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Subaccount, Location, Usage, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, LD WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
End If
ElseIf Option_Service = "Pagers" Then
If (Not(Option_FirstDropdown = "")) AND (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, Pagers.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Owner_Name, Pager_Number, Notes, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Pagers WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Owner_Name = '" & Option_FirstDropdown & "' AND Pager_Number = '" & Option_SecondDropdown & "' AND Pagers.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Pagers." & Option_ColumnSort
ElseIf (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, Pagers.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Owner_Name, Pager_Number, Notes, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Pagers WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Pager_Number = '" & Option_SecondDropdown & "' AND Pagers.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Pagers." & Option_ColumnSort
ElseIf (Not(Option_FirstDropdown = "")) Then
strDetailedInfo = "SELECT ID, Pagers.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Owner_Name, Pager_Number, Notes, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Pagers WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Owner_Name = '" & Option_FirstDropdown & "' AND Pagers.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Pagers." & Option_ColumnSort
Else
strDetailedInfo = "SELECT ID, Pagers.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Owner_Name, Pager_Number, Notes, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Pagers WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Pagers.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Pagers." & Option_ColumnSort
End If
ElseIf Option_Service = "WAN" Then
If (Not(Option_FirstDropdown = "")) AND (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, WAN.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Circuit, Location_A, Location_B, Speed, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, WAN WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Circuit = '" & Option_SecondDropdown & "' AND (Location_A LIKE '%" & Option_FirstDropdown & "%' OR Location_B LIKE '%" & Option_FirstDropdown & "%') AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, WAN.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Circuit, Location_A, Location_B, Speed, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, WAN WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Circuit = '" & Option_SecondDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_FirstDropdown = "")) Then
strDetailedInfo = "SELECT ID, WAN.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Circuit, Location_A, Location_B, Speed, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, WAN WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND ((Location_A LIKE '%" & Option_FirstDropdown & "%' OR Location_B LIKE '%" & Option_FirstDropdown & "%') OR (Location_A = '" & Option_FirstDropdown & "' OR Location_B = '" & Option_FirstDropdown & "')) AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
Else
strDetailedInfo = "SELECT ID, WAN.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Circuit, Location_A, Location_B, Speed, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, WAN WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
End If
ElseIf Option_Service = "Misc" Then
If (Not(Option_FirstDropdown = "")) AND (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, Misc.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Misc WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Type = '" & Option_SecondDropdown & "' AND Carrier = '" & Option_FirstDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_SecondDropdown = "")) Then
strDetailedInfo = "SELECT ID, Misc.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Misc WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Type = '" & Option_SecondDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
ElseIf (Not(Option_FirstDropdown = "")) Then
strDetailedInfo = "SELECT ID, Misc.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Misc WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' Carrier = '" & Option_FirstDropdown & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
Else
strDetailedInfo = "SELECT ID, Misc.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Misc WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND " & Option_Service & ".Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY " & Option_Service & "." & Option_ColumnSort
End If
End If
Else
If (Option_CostCenter = "" AND Option_Account = "") Then
If Option_Service = "Mobile" Then
strDetailedInfo = "SELECT ID, Long_Date, Carrier, Account, Mobile, Owner_Name, Mobile.Cost_Center, " & GLholder & "Location, Plan, Total_Used, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Mobile WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Mobile.Carrier = '" & Option_Carrier & "' AND Mobile.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Mobile." & Option_ColumnSort & ""
ElseIf Option_Service = "Local" Then
strDetailedInfo = "SELECT ID, Local.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Earning_No, Charge, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Local WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Local.Carrier = '" & Option_Carrier & "' AND Local.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Local." & Option_ColumnSort & ""
ElseIf Option_Service = "LD" Then
strDetailedInfo = "SELECT ID, LD.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Subaccount, Location, Usage, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, LD WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND LD.Carrier = '" & Option_Carrier & "' AND LD.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY LD." & Option_ColumnSort & ""
ElseIf Option_Service = "Pagers" Then
strDetailedInfo = "SELECT ID, Pagers.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Owner_Name, Pager_Number, Notes, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Pagers WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Pagers.Carrier = '" & Option_Carrier & "' AND Pagers.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Pagers." & Option_ColumnSort & ""
ElseIf Option_Service = "WAN" Then
strDetailedInfo = "SELECT ID, WAN.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Circuit, Location_A, Location_B, Speed, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, WAN WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND WAN.Carrier = '" & Option_Carrier & "' AND WAN.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY WAN." & Option_ColumnSort & ""
ElseIf Option_Service = "Misc" Then
strDetailedInfo = "SELECT ID, Misc.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Misc WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Misc.Carrier = '" & Option_Carrier & "' AND Misc.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Misc." & Option_ColumnSort & ""
End IF
ElseIf (Option_Carrier = "" AND Option_Account = "") Then
If Option_Service = "Mobile" Then
strDetailedInfo = "SELECT ID, Long_Date, Carrier, Account, Mobile, Owner_Name, Mobile.Cost_Center, " & GLholder & "Location, Plan, Total_Used, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Mobile WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Mobile.Cost_Center = '" & Option_CostCenter & "' AND Mobile.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Mobile." & Option_ColumnSort & ""
ElseIf Option_Service = "Local" Then
strDetailedInfo = "SELECT ID, Local.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Earning_No, Charge, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Local WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Local.Cost_Center = '" & Option_CostCenter & "' AND Local.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Local." & Option_ColumnSort & ""
ElseIf Option_Service = "LD" Then
strDetailedInfo = "SELECT ID, LD.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Subaccount, Location, Usage, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, LD WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND LD.Cost_Center = '" & Option_CostCenter & "' AND LD.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY LD." & Option_ColumnSort & ""
ElseIf Option_Service = "Pagers" Then
strDetailedInfo = "SELECT ID, Pagers.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Owner_Name, Pager_Number, Notes, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Pagers WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Pagers.Cost_Center = '" & Option_CostCenter & "' AND Pagers.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Pagers." & Option_ColumnSort & ""
ElseIf Option_Service = "WAN" Then
strDetailedInfo = "SELECT ID, WAN.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Circuit, Location_A, Location_B, Speed, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, WAN WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND WAN.Cost_Center = '" & Option_CostCenter & "' AND WAN.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY WAN." & Option_ColumnSort & ""
ElseIf Option_Service = "Misc" Then
strDetailedInfo = "SELECT ID, Misc.Cost_Center, Carrier, " & GLholder & "Long_Date, Account, Location, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Misc WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Misc.Cost_Center = '" & Option_CostCenter & "' AND Misc.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Misc." & Option_ColumnSort & ""
End If
Else
If Option_Service = "Mobile" Then
strDetailedInfo = "SELECT ID, Long_Date, Carrier, Account, Mobile, Owner_Name, Mobile.Cost_Center, " & GLholder & "Location, Plan, Total_Used, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Mobile WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Mobile.Account = '" & Option_Account & "' AND Mobile.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Mobile." & Option_ColumnSort & ""
ElseIf Option_Service = "Local" Then
strDetailedInfo = "SELECT ID, Local.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Earning_No, Charge, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Local WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Local.Account = '" & Option_Account & "' AND Local.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Local." & Option_ColumnSort & ""
ElseIf Option_Service = "LD" Then
strDetailedInfo = "SELECT ID, LD.Cost_Center, " & GLholder & "Long_Date, Carrier, Account, Subaccount, Location, Usage, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, LD WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND LD.Account = '" & Option_Account & "' AND LD.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY LD." & Option_ColumnSort & ""
ElseIf Option_Service = "Pagers" Then
strDetailedInfo = "SELECT ID, Pagers.Cost_Center, " & GLholder & "Carrier, Long_Date, Account, Location, Owner_Name, Pager_Number, Notes, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Pagers WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Pagers.Account = '" & Option_Account & "' AND Pagers.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Pagers." & Option_ColumnSort & ""
ElseIf Option_Service = "WAN" Then
strDetailedInfo = "SELECT ID, WAN.Cost_Center, " & GLholder & "Carrier, Long_Date, Account, Circuit, Location_A, Location_B, Speed, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, WAN WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND WAN.Account = '" & Option_Account & "' AND WAN.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY WAN." & Option_ColumnSort & ""
ElseIf Option_Service = "Misc" Then
strDetailedInfo = "SELECT ID, Misc.Cost_Center, " & GLholder & "Carrier, Long_Date, Account, Location, Type, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Misc WHERE Long_Date >= '" & Option_Date & "' AND Long_Date < '" & NextMonth & "' AND Misc.Account = '" & Option_Account & "' AND Misc.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = '" & strSession_UID & "' ORDER BY Misc." & Option_ColumnSort & ""
End If
End If
End If

Dim objRS_DetailedInfo
Set objRS_DetailedInfo = Server.CreateObject("ADODB.Recordset")
objRS_DetailedInfo_Open strDetailedInfo,objConn,adOpenKeyset
 
As I think I've told you before, the best way to debug code like this is to find out what is actually being sent to SQL Server. In the case of ASP you can do this by putting a "Response.Write strSQL" statement right before you try and execute the SQL (obviously strSQL is the SQL string you are trying to execute).

Do this and paste the actual result here.

--James
 
oh yeah, duh. im sorry dude. when something dont work right i get frantic and dont think too good. i need to learn to calm down. here is the result. i will not forget to do this again.

SELECT ID, Long_Date, Carrier, Account, Mobile, Owner_Name, Mobile.Cost_Center, Location, Plan, Total_Used, Total, Actual_Past_Due AS APD, Credit FROM UID_CostCenter, Mobile WHERE Long_Date >= '1/1/2005' AND Long_Date < '2/1/2005' AND Mobile.Cost_Center = '1003310.57920' AND Mobile.Cost_Center = UID_CostCenter.Cost_Center AND UID_CostCenter.UID = 'admincii' ORDER BY Mobile.Account
 
PLAN is a reserved word. Put brackets around it:

Code:
SELECT ..., [Plan], ...

--James
 
yep that has it , thanks for the tip. im going to look up SQL reserved words and print it out for future reference. Now my co. server is completely SQL and up and running.
thanks again for your help jameslean.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top