To create the button, follow these steps:
- Open the Form in Design Mode.
- Click the Command Button control and click and drag where you want to locate the button in your form.
- Click Cancel to cancel the Command wizard.
- Right-click the Command button and click Properties.
- Under the All tab, click in the Caption property box and enter Send Shipping Confirmation.
- Under the Event tab, click in the OnClick property box and then click the Build button and enter the following code at the prompt, as shown in Figure B:
MessText = "Your order has shipped!" & vbCrLf & _
"Order Number:" & " " & Me.OrderID & " " & _
"Order Date:" & " " & Me.OrderDate & vbCrLf & _
"Shipped to:" & vbCrLf & _
Me.ShipName & vbCrLf & _
Me.ShipAddress & vbCrLf & _
Me.ShipCity & ", " & Me.ShipStateOrProvince & " " & Me.ShipPostalCode
Subject:="Order Confirmation", _
- Press Alt + Q.
Now, when the user enters the ship date and clicks the Send Shipping Confirmation button, Access will compose the e-mail shown in Figure C.
The user can review the e-mail and click the Send button. Access will then send the e-mail to the address in the ShipEmail field for that order.
Miss an Access tip?
Check out the Microsoft Access archive and catch up on other Access tips.
Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.