okasanmarisa
New member
- Local time
- Today, 17:47
- Joined
- Nov 3, 2020
- Messages
- 7
Hello, I need to know how I can insert all the data of a report that I have created in Access and VBA.
What I want to do is the following I have 3 tables: Carrito (In it everything will be added as if it were a shopping list)
Ingredientes (It has associated all the ingredients and the id of the recipe to which it corresponds)
And finally the Planing table (In this table you can add the days and the type of food and the recipe id, the idea is to create a report from this table. And it will show me the days and the recipe assigned lastly a button called Add to purchase, what this button will do is first compare which ingredients have the same recipe associated with the planing table if they match this table, only the id_receta will be inserted in the table carrito.
Here I explain the problem, I make the query in VBA, but when I click the button, it only inserts the first record of id_receta I want it to enter everything in the cart table, it is as if I only took the first id of the report, others not.
I show the captures
The Report "Planing" only inserts 5 registers. only the id 4, not all the ids.
The VBA query is the next:
Dim SQL As String
SQL = "INSERT into carrito select * from ingredientes WHERE id_receta = planing.id_receta;"
DoCmd.RunSQL SQL
What I want to do is the following I have 3 tables: Carrito (In it everything will be added as if it were a shopping list)
Ingredientes (It has associated all the ingredients and the id of the recipe to which it corresponds)
And finally the Planing table (In this table you can add the days and the type of food and the recipe id, the idea is to create a report from this table. And it will show me the days and the recipe assigned lastly a button called Add to purchase, what this button will do is first compare which ingredients have the same recipe associated with the planing table if they match this table, only the id_receta will be inserted in the table carrito.
Here I explain the problem, I make the query in VBA, but when I click the button, it only inserts the first record of id_receta I want it to enter everything in the cart table, it is as if I only took the first id of the report, others not.
I show the captures
The Report "Planing" only inserts 5 registers. only the id 4, not all the ids.
The VBA query is the next:
Dim SQL As String
SQL = "INSERT into carrito select * from ingredientes WHERE id_receta = planing.id_receta;"
DoCmd.RunSQL SQL