Photo AI
Question 2
Smart home devices are becoming more popular among people that have access to fast reliable internet connections. A database called SmartDevicesDB.mdb has been deve... show full transcript
Step 1
Answer
To display the products:
Access the tblManufacturers: Start by looping through the tblManufacturers
to access each manufacturer.
Display Manufacturer Information: For each manufacturer, display the ManufacturerName
and ContactNumber
in a specific component (e.g., a label).
Set Up Headings: In the output section, prepare the headings: 'Device name', 'In stock', and 'Price'.
Access the tblDevices: For each manufacturer, loop through tblDevices
to check for matching ManufacturerID
.
Display Device Information: For each device made by the manufacturer, display the DeviceName
, NumInStock
, and Price
. Ensure that the Price
is formatted correctly as a string.
End the Loop: Finish each loop correctly to ensure all data is displayed without omissions.
Step 2
Answer
To update the stock when devices are sold:
Input Dialog for Quantity: Extract the number of devices to sell using an input dialog box and convert it into an integer.
Check Stock Availability: Use an if
statement to test whether tblDevices.NumInStock
is greater than or equal to the specified quantity.
Update Stock: If there is sufficient stock, decrease the NumInStock
by the value given in the input dialog. Update the database accordingly.
Insufficient Stock Handling: If the stock is not sufficient, display a message to the user indicating that there are not enough items in stock.
Report Improved Results
Recommend to friends
Students Supported
Questions answered