Affichage des articles dont le libellé est Need Help with this Insert query. Afficher tous les articles
Affichage des articles dont le libellé est Need Help with this Insert query. Afficher tous les articles

Need Help with this Insert query

samedi 18 avril 2015

DoCmd.RunSQL (" Insert into TbBookingCustomerDependent (bookingid, customerid) values ( " & test & " , select ID from TblCustomers where HeadID = " & Me.txtCustomerID.Value & " ")



I have two tables TblCustomers & TbBookingCustomerDepended (weird name huh). TblCustomer holds all my customer details. Whenever a customer makes a booking (Through booking form) and that booking relates to multiple customers, i want to insert data about those customer into TbBookingCustomerDependent.



E.g.



Customer books 5 seats on a flight, now the detail of the customer booking the seats would go into tblbooking, and the remaining 4 customers would be related to this booking in TbBookingCustomerDependent - which contains only 2 fields bookingID and customerID.



In the above query test variable contains the bookingID.



When i run the above code in vba on buttonclick, i get the following error



Run-time error 3075



syntax error in query expression 'select ID from tblcustomers where headid = 1'

Need Help with this Insert query

Labels