我是数据库中的新手,这不是我的课程,但我喜欢编程。
我创建了一个简单的数据库,客户可以使用它来请求样品。
我的问题是,当两个用户添加新记录时,我无法使数据库正常工作。
以下是我们点击“发送”按钮时的代码。
DoCmd.SendObject acSendNoObject, , , _
"michael.manalo@yahoo.com;", _
, , _
"Sample Request from " & [Location], "Dear RCM Project Engineering, " & Chr$(13) & Chr$(13) & _
"I would like to request for samples to be shipped to:" & Chr$(13) & Chr$(13) & _
[Contact] & Chr$(13) & [Shipping Address] & Chr$(13) & Chr$(13) & _
"Details of my request were recorded in SRN " _
& [SRN] & Chr$(13) & Chr$(13) & _
"The customer is requesting for:" & Chr$(13) & Chr$(13) & _
[QTY1] & " " & [PN1] & ", " & [Des1] & Chr$(13) & _
[QTY2] & " " & [PN2] & ", " & [Des2] & Chr$(13) & _
[QTY3] & " " & [PN3] & ", " & [Des3] & Chr$(13) & _
[QTY4] & " " & [PN4] & ", " & [Des4] & Chr$(13) & _
[QTY5] & " " & [PN5] & ", " & [Des5] & Chr$(13) & _
[QTY6] & " " & [PN6] & ", " & [Des6] & Chr$(13) & _
[QTY7] & " " & [PN7] & ", " & [Des7] & Chr$(13) & _
[QTY8] & " " & [PN8] & ", " & [Des8] & Chr$(13) & Chr$(13) & _
"Please note of the following: " & Chr$(13) & Chr$(13) & _
[Remarks] & Chr$(13) & Chr$(13) & _
"Expected Delivery Date is on: " & [Requested Delivery Date] & Chr$(13) & Chr$(13) & _
"Thank You!" & Chr$(13) & Chr$(13) & Form_Choose.user & Chr$(13) & [Position]
DoCmd.Save acForm, "Sample_Requisition"
[Requestor] = Form_Choose.user
[Requestor]字段是必需的,我将其锁定以供用户编辑,因为我希望客户在保存记录之前成功通过电子邮件发送请求。如果他们成功通过电子邮件发送请求,当前用户(来自“选择”表单)将自动记录在请求者字段中。