我有两种形式var val = [14, 20 , 40 , 40,9];
var time = ["6:28 PM","7:28 PM","8:28 PM","9:28 PM"];
var resultArr = [];
for(var i=0;i<val.length;i++){
resultArr.push({x:val[i],y: ((time[i] !== undefined)?time[i]:'')});
}
console.log(resultArr);
和frmProductCreate
。
在frmColourCreate
中,我有:
frmProductCreate
colourID
该想法是,如果用户需要创建新颜色,则可以单击创建按钮,打开btnColCreate
,命名新颜色,然后单击保存按钮。它将新颜色保存在颜色表中(这是frmColourCreate
中cbo ColourID
的记录源)。然后在frmProductCreate
中重新查询colourID
,然后关闭frmProductCreate
。
我还要此保存按钮执行的操作是在重新查询后选择cbo frmColourCreate
并转到最后创建的颜色。即最后一条记录。我尝试了一些代码,但未能使其正常工作。任何帮助将不胜感激。
colourID
答案 0 :(得分:0)
一些评论:
cancel
是什么?由于未使用,因此将其删除。Me.ColName = ""
。DoCmd.Close
移到了结尾。IFs
)使您的代码更具可读性。最后尝试一下:
Private Sub btnSavecol_Click()
If Me.ColName.Value = "" Then
MsgBox "You must enter a Colour Name."
DoCmd.GoToControl "ColName"
Exit Sub
End If
If MsgBox("Are you sure you want to create new Colour?", vbYesNo) = vbNo Then Exit Sub
CurrentDb.Execute "INSERT INTO Colours (ColName) VALUES ('" & Me.ColName.Value & "')"
If Not CurrentProject.AllForms("frmProductCreate").IsLoaded Then GoTo Done
Forms!frmproductCreate!ColourID.Requery
'This sets the ComboBox 'ColourID' to the new colour:
'Forms!frmproductCreate!ColourID.Value = Me.ColName.Value
'If you use an automatic generated ID in the table 'Colours', then you will have to get that ID from the color and set it to the ComboBox:
Forms!frmproductCreate!ColourID.Value = DLookup("ColID", "Colours", "ColName = '" & Me.ColName.Value & "'")
Me.ColName.Value = ""
If Not CurrentProject.AllForms("frmProductDetails").IsLoaded Then GoTo Done
Forms!frmproductDetails!ColourID.Requery
Done:
DoCmd.Close
End Sub