- Joined
- Feb 16, 2018
- Messages
- 1
- Reaction score
- 0
Hi, I've got three tables. I want to create a form [unbound type] that passes the value of the form to the table. My form works like this, First I need to enter the customerID, second, I created a combo box which displays all of my products and the third one is my Quantity. I need to click the Add&Save button so that it will be inserted into my orderT but a problem occurs.
Private Sub Command17_Click()
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from Order")=> This is my table to be insert with IDs from the other two tables.
rec.AddNew
rec("CustID") = Me.txtCustomerID /* I need to insert my ID of customer */
rec("ProdID") = Me.txtProdID /* I need to insert the product ID */
rec("Qty") = Me.txtQuantity /* I need to insert the quantity*/
rec.Update
Set rec = Nothing
Set db = Nothing
End Sub
After running I got this run-time error 3131, syntax error in FROM clause =>Set rec = db.OpenRecordset("Select * from Order")
Krishna
Private Sub Command17_Click()
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from Order")=> This is my table to be insert with IDs from the other two tables.
rec.AddNew
rec("CustID") = Me.txtCustomerID /* I need to insert my ID of customer */
rec("ProdID") = Me.txtProdID /* I need to insert the product ID */
rec("Qty") = Me.txtQuantity /* I need to insert the quantity*/
rec.Update
Set rec = Nothing
Set db = Nothing
End Sub
After running I got this run-time error 3131, syntax error in FROM clause =>Set rec = db.OpenRecordset("Select * from Order")
Krishna