我有一个Access 2007应用程序,我有一个multitab表单。其中一个选项卡是三个列表框,在打开时重新查询。数据是通过sql passthrough查询提取的。下面是查询。该查询可以提取预算时间,实际小时数等以及方差。预算时间等于1,因为他们没有任何小时但是对项目收费。我希望显示0而不是1.
strSQL = "select distinct substring(tbl_Project_Staffing_Profile.Resource_Name,1,255) as [RESOURCE NAME],"
strSQL = strSQL & " tbl_Project_Staffing_Profile.ProjectStatus as [PROJECT STATUS], tbl_Project_Staffing_Profile.orig_Budget as [BUDGETED HOURS], tbl_Project_Staffing_Profile.FTE_used as [HOURS USED],"
strSQL = strSQL & " tbl_Project_Staffing_Profile.ETC as [ESTIMATE TO COMPLETE], tbl_Project_Staffing_Profile.tot_var as [TOTAL VARIANCE TO DATE] from tbl_Project_Staffing_Profile , tbl_ProjectMaster"
strSQL = strSQL & " where tbl_Project_Staffing_Profile.Project_Request_ID = tbl_ProjectMaster.ProjectRequestID"
strSQL = strSQL & " and tbl_ProjectMaster.ProjectMasterID = " & GetProjectMasterID() & ";"
DoCmd.DeleteObject acQuery, "x_query_Project_Staffing_Profile"
Call CreatetmpSQLPassthrough(strSQL, "x_query_Project_Staffing_Profile")
strSQL = "x_query_Project_Staffing_Profile"
DoEvents
Me.TabCtl0.Pages(iCurrTabPage).Controls(0).RowSource = strSQL
List231.Requery
List233.Requery
List235.Requery
答案 0 :(得分:0)
尝试IIf
:
strSQL = "select distinct substring(tbl_Project_Staffing_Profile.Resource_Name,1,255) as [RESOURCE NAME]," & _
" tbl_Project_Staffing_Profile.ProjectStatus as [PROJECT STATUS], IIF(tbl_Project_Staffing_Profile.orig_Budget=1, 0, tbl_Project_Staffing_Profile.orig_Budget) as [BUDGETED HOURS], tbl_Project_Staffing_Profile.FTE_used as [HOURS USED]," & _
" tbl_Project_Staffing_Profile.ETC as [ESTIMATE TO COMPLETE], tbl_Project_Staffing_Profile.tot_var as [TOTAL VARIANCE TO DATE] from tbl_Project_Staffing_Profile , tbl_ProjectMaster" & _
" where tbl_Project_Staffing_Profile.Project_Request_ID = tbl_ProjectMaster.ProjectRequestID" & _
" and tbl_ProjectMaster.ProjectMasterID = " & GetProjectMasterID() & ";"