Boutique Fudge . - , (, ), .
ProductID . , Access. Access , : (On Not In List).
(On Not
In List), Access . , , Access .
(On Not In List) : NewData Response. NewData , . Response , , Access , .
, Access, (On Not In List) ProductID:
Private Sub ProductID_NotInList(NewData As String, Response As Integer) End Sub
(On Not In List), , , , . MsgBox, . Access : (Yes) (No). MsgBox , , :
Dim ButtonClicked
ButtonClicked = MsgBox("Do you want to add a new product?", vbYesNo)
ButtonClicked . ( ), Visual Basic ButtonClicked , , . 6, , 7, . , , vbYes ( 6) vbNo ( 7).
(On Not In List). , (. 17.12), , , , :
Private Sub ProductID_NotInList(NewData As String, Response As Integer) ' /
Dim ButtonClicked
ButtonClicked = MsgBox("Do you want to add a new product for " & _
|
|
NewData & "?", vbYesNo)
' Visual Basic vbYes vbNo,
'
If ButtonClicked = vbNo Then
'
ProductID.Undo
' Access .
'
Response = acDataErrContinue
Else
' ( )
End If End Sub
. 17.12. . <Enter>,
, . , -| (, ), [ . . DoCmd. OpenForm:
' Access ,
Response = acDataErrAdded
' AddProduct
DoCmd.OpenForm "AddProduct",,,,, acDialog, NewData
, OpenForm, .
■ acDialog , . . Access ProductID_NotInList , AddProduct . , PlaceOrder.
■
NewData AddProduct.OpenArgs. AddProduct , , .
, AddProduct (, NewData ) ProductName AddProduct.
Private Sub Form_0pen(Cancel As Integer)
ProductName = Form.OpenArgs
End Sub
. 17.13 , .
. 17.13. AddProduct , . , , Access , ( ). Access , (Pop Up) (Data Entry)
, AddProduct. ProductID_NotInList . DoCmd. OpenForm. , , :
' ,
' , ProductID.Undo
' ProductlD.Requery
' ProductID DLookup
|
|
Product ID = DLookup (ID, "Products", "ProductName='" & NewData & '"")
, , <Esc> AddProduct. DLookup , Null ( ) ProductlD. Access, , .
. (On Not In List), (On Change) . , , Price .
, . , Access , ( ProductID_Change): Product ID_Change
, Boutique Fudge .