Setting the Product IDWhen the user selects a product, we need to have a variable into which to place the selected product ID, so we'll declare a variable in the form declarations using the code in Listing 28.3. Listing 28.3 - RECVNG.FRM - The declarations section for our form, declaring a variable which we can use for holding the selected product ID. Option Explicit 'We always return the same error number Private Const ERROR_NUMBER = vbObjectError + 0 'The currently selected product ID Dim iiProductID As Long We'll set the product ID into this variable whenever the user selects a product from the list by navigating in the Remote Data Control to the currently selected row, and then getting the Prd_ID column from that row, as in Listing 28.4. Listing 28.4 - RECVNG.FRM - When the user selects a product, we need to grab the product ID from the Remote Data Control. Private Sub dbcProduct_Click(Area As Integer) Dim varCurRecord As Variant 'What is the currently selected item? varCurRecord = dbcProduct.SelectedItem 'Move to the selected record in the result set MSRDC1.Resultset.Move 0, varCurRecord 'Grab the product ID iiProductID = MSRDC1.Resultset!Prd_ID.Value End Sub
|
|
![]() |
![]() |
|||