(Note: the customer field has a one to many relationship with id) I want to create form where I put in the product, and select which customer is ordering this from some kind of dropdown menu. How do you achieve this in Access? From my research all I can do is create a form that contains placeholders for the fields in the current table but nothing that takes advantage of the relationship to help me fill out the customer field.
asked Jul 7, 2015 at 0:22 CodyBugstein CodyBugstein 1,595 8 8 gold badges 23 23 silver badges 35 35 bronze badgesYes, you absolutely can do this. There are a few tricks, but not many.
I normally save the query behind the combo separately. Then in step 6 you select the query rather than paste the SQL. The reason for this is that you can potentially re-use data sources for common combo boxes. Naming conventions are a very good thing when your database grows, so be logical about what you call things.
On this note, I would change the name of your table variables to below. To me, this is clearer. Orders needs an ID as well. If the ID's have the same name, you just play "match the name" when joining tables.
**Customers** => (CustomerID, firstname, lastname, address) ^ \ **Orders** => (OrderID, CustomerID, product, total)
You could also combine the First/Last into one field rather than have them separate (in the query have a field Custname: [Firstname] & " " & [Lastname]). You can make the combo boxes really powerful in access, but watch out if they have a LOT of rows in them - they will slow down.
For the products on the order, you really need to create another table called "Order Lines" which has OrderLineID, OrderID, ProductID and Qty as fields. Then a single order can have multiple products. This is beyond the scope of the question, but I thought I'd point you in the right direction there too. You need a product table as well.