我有一个子表单,我试图根据多个复选框选择进行更改。对于每个复选框,我编写了一个更新后事件,根据检查的框/选择了多少个框来调用公共函数。函数的第一部分如下,其中Home是主窗体,“ALLProgressTracking”是子窗体:
Public Function ProgressDisplay(argNoFields As Integer, Optional argField1 As String, Optional argField2 As String, Optional argField3 As String)
Dim strSQL As String
If argNoFields = 1 Then
strSQL = "TRANSFORM Sum([StatusTracking Query].CountofProjectID) AS CountOfProjects " & _
"SELECT [StatusTracking Query]." & argField1 & " " & _
"FROM [StatusTracking Query] " & _
"GROUP BY [StatusTracking Query]." & argField1 & " " & _
"PIVOT [StatusTracking Query].ValueDate;"
Forms!Home![ALLProgressTracking].SourceObject = "Form.IndProgressTracking"
Forms!Home![ALLProgressTracking].Form.RecordSource = strSQL
问题是我已经使用三个可能字段之一构建的表单绑定为行标题之一(它是交叉表格形式/查询)因此当我尝试使用上面的代码更改SQL时备用字段我得到#Name而不是正确的行标题。 我猜这是一个改变SQL语句来引用我调用的子窗体函数作为源对象的问题,但我对如何实现这一点感到很遗憾。
例如,对于表单IndProgressTracking,我有以下SQL表单:
TRANSFORM Sum([StatusTracking Query].CountOfProjectID) AS SumOfCountOfProjectID
SELECT [StatusTracking Query].Category
FROM [StatusTracking Query]
GROUP BY [StatusTracking Query].Category
PIVOT [StatusTracking Query].ValueDate;
当我将“状态”提供给函数时,表单将加载项目计数的正确数字,但#Name作为所有行标题。
希望这一切都有意义,有人能够提供帮助!
答案 0 :(得分:0)
您可以将字段名称别名为静态:
var myapp = angular.module('myApp', ['leaflet-directive']);
myapp.controller('PredictionCtrl',
function($http, $scope, ProductData, $timeout) {
$scope.productData = ProductData;
var markers = {};
var i = 0;
angular.forEach($scope.productData.products, function(product) {
markers[i++]={
lat: product.location.lat,
lng: product.location.lng,
message: "aaaa",
focus: false,
draggable: false
};
$scope.markers = markers;
});
angular.extend($scope, {
vegas: {
lat: 36.167583,
lng: -115.141892,
zoom: 14
}
});
});
myapp.factory('ProductData', function() {
var products = [
{ pID : 1,
p_name : "Pawn Stars Tour",
location: {
address : {
street: "713 S Las Vegas Blvd",
street2 : "",
city : "Las Vegas",
zip : 89101,
country : "USA"
},
lat : 36.1616821,
lng : -115.1474645,
},
phone : "+1 702-385-7912"
},
//product 2
{
pID: 2,
p_name : "Sunset Grand Canyon Helicopter Tour",
rank_init : 0.99999998,
location : {
address : {
street : "5596 Haven St",
street2 : "",
city : "Las Vegas",
zip : 89119,
country : "USA"
},
district : "Downtown",
lat : 36.0880348,
lng : -115.1667809
},
phone : "+1 702-736-0606"
},
//product3
{
pID: 3,
p_name : "Dream Racing Experience",
location : {
address : {
street : "Las Vegas Motor Speedway",
street2 : "7000 N Las Vegas Blvd",
city : "Las Vegas",
zip : 89115,
country : "USA"
},
district : "North Las Vegas",
lat : 36.2728959,
lng : -115.0110197
},
phone : "+1 702-599-5199"
}];
return products;
});
答案 1 :(得分:0)
我能够通过在记录源代码行之后的函数末尾添加这一行来解决问题:
Forms!Home![ALLProgressTracking].Form.[TrackingMetric].ControlSource = argField1
[TrackingMetric]
是以前显示#Name?
的绑定文本框的名称。