A Guide to SQL
A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
Expert Solution & Answer
Book Icon
Chapter 8, Problem 7TD

Explanation of Solution

a.

Deleting query in the table “ORDERS”:

Public Function Order_Delete(I_ORDER_NUM)

    Dim strSQL As String

    strSQL = "DELETE FROM ORDERS WHERE ORDER_NUM = '"

    strSQL = strSQL & I_ORDER_NUM

    strSQL = strSQL & "'"

    DoCmd.RunSQL strSQL

End Function

 Explanation:

  • Create a function named as “Order_Delete” and pass an argument “I_ORDER_NUM”.
  • Set the strSQL string variable to “DELETE FROM ORDERS WHERE ORDER_NUM = '” and makes everything necessary in the command up to and including the single quotation mark preceding the order number.
  • The next command will concatenated previous value with the value in “I_ORDER_NUM”.
  • The final command is used to set strSQL to the output of the value already created, concatenated with a single quotation mark...

Explanation of Solution

b.

Updating query:

Public Function Order_Update(I_ORDER_NUM, I_ORDER_DATE)

    Dim strSQL As String

    strSQL = "UPDATE ORDERS SET ORDER_DATE = '"

    strSQL = strSQL & I_ORDER_DATE

    strSQL = strSQL & "' WHERE ORDER_NUM = '"

    strSQL = strSQL & I_ORDER_NUM

    strSQL = strSQL & "'"

    DoCmd.RunSQL strSQL

End Function

 Explanation:

  • Create a function named as “Order_Update” and pass the arguments “I_ORDER_NUM” and “I_ORDER_DATE”.
  • Set the strSQL string variable to “UPDATE ORDERS SET ORDER_DATE = '” and makes everything necessary in the command up to and including the single quotation mark preceding the order number.
  • Here, the user pass two arguments, so there are two portions of the construction of the SQL command that involve variables...

Explanation of Solution

c.

Retrieving the list in the table “ITEM”:

Public Function Find_Items(I_CATEGORY)

    Dim rs As New ADODB.Recordset

    Dim cnn As ADODB.Connection

    Dim strSQL As String

    Set cnn = CurrentProject.Connection

    strSQL = "SELECT ITEM_NUM, DESCRIPTION, STOREHOUSE, PRICE FROM ITEM WHERE CATEGORY= '"

    strSQL = strSQL & I_CATEGORY

    strSQL = strSQL & "'"

    rs.Open strSQL, cnn, adOpenStatic, , adCmdText

    Do Until rs.EOF

        Debug.Print (rs!ITEM_NUM)

        Debug.Print (rs!Description)

        Debug.Print (rs!STOREHOUSE)

        Debug.Print (rs!PRICE)

        rs.MoveNext

    Loop

End Function

 Explanation:

  • Create a function named as “Find_Items” and pass an argument “I_CATEGORY”.
  • The “rs” and “cnn” is used to processing the “Recordset” and “ADODB.Connection”...

Blurred answer
Students have asked these similar questions
Create a function to insert a new product into an existing order, include the product id, unit price, quantity. The output of the function is the message to notify the calling program whether the update succeeded or not.
Access Assignment   Problem: JMS TechWizards is a local company that provides technical services to several small businesses in the area. The company currently keeps its technicians and clients’ records on papers. The manager requests you to create a database to store the technician and clients’ information. The following table contains the clients’ information. Client Number Client Name Street City State Postal Code Telephone Number Billed Paid Technician Number AM53 Ashton-Mills 216 Rivard Anderson TX 78077 512-555-4070 $315.50 $255.00 22 AR76 The Artshop 722 Fisher Liberty Corner TX 78080 254-555-0200 $535.00 $565.00 23 BE29 Bert's Supply 5752 Maumee Liberty Corner TX 78080 254-555-2024 $229.50 $0.00 23 DE76 D & E Grocery 464 Linnell Anderson TX 78077 512-555-6050 $485.70…
Which of the following statements is true? (refer to the tables in the JustLee Books database.)a. The MIN function can be used only with numeric data.b. The MAX function can be used only with date values.c. The AVG function can be used only with numeric data.d. The SUM function can’t be part of a nested function.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Text book image
Oracle 12c: SQL
Computer Science
ISBN:9781305251038
Author:Joan Casteel
Publisher:Cengage Learning
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning