北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |
2 4
Private Sub AddToOrder_Click() On Error GoTo Err_AddToOrder_Click If DCount("[OrderID]", "T_Order_line", "ProductID=" & Me.ProductID) Then 'Counts and compares the records in "T_Order_line" and ensures that records are not duplicated. Me.ProductID.Undo 'cancels an entry if a duplicate is found MsgBox "Warning! ProductID." _ & Me.ProductID & vbCr & "has already been entered into this order " _ & vbCr & vbCr & "Please check ordered items", _ vbInformation, "Duplicate Information" MsgBox "Please select another product to add to current order", _ vbInformation, "Duplicate Information" Else Forms![F_Orders]![F_Order_line_subform].SetFocus Me.ProductID.SetFocus 'navigates between the F_Order_line_subform and the F_PC subform DoCmd.GoToRecord , , acNewRec 'adds a new line for each new record entered Me.Parent.F_Order_line_subform.Form!ProductID = Me.ProductID 'Transfers data from one subform to another. MsgBox "The order of ProductID." _ & Me.ProductID & vbCr & "has been transfered, Please enter required product quantity to the recent order entry" End If Exit_AddToOrder_Click: Exit Sub Err_AddToOrder_Click: Resume Exit_AddToOrder_Click End Sub