How to insert data to table from report?

illusionek

Registered User.
Local time
Yesterday, 19:46
Joined
Dec 31, 2013
Messages
92
Hello!

I am having a problem with below and I wonder if anyone could help.

I have a report, which is based on query that links various table.

There is also a form, which starts when the report opens, which has dual function: 1.) user selects criteria to filter out only particular customer but 2.) is for user to add some new data that are not available in query/linked tables. I need to be able to create now a command button that would add all records from the report to for example 'Report Table'. My report has a tabular form but I have also lots of text-boxes in Report Header that would need to be added too.

Can anyone help please? I tried to google it but can't really find any solution. All posts I have seen so far were about inserting table into report :)


Many thanks!
 
Any ideas? I am sure someone must know a nice easy trick to solve this :D

I have been trying below code but it works only for text boxes in report header. Unfortunately I cannot add all the lines from the report as it adds only first line.

I guess I would need to apply a loop here but I do not really know how to do it. I also wonder if there would be a more efficient way of doing this than VBA


Thanks!

Code:
Set dbs = CurrentDb
dbs.Execute "Insert into [Table1] ([SKU]) values ('" & [Reports]![Query1]![SKU] & "')"
 
The first question would be why you're using data in a report, which by definition comes from the database, and re-inserting it into the database? That sounds like you have tables with duplicate data, meaning you have bigger problems due to the database's tables not being normalized.
 
I know I should use a form to update database and then generate a report but I was not having any luck with forms and found an easy way of getting what I want through reports. So now I am just trying to make it work :)

I am not concerned with a size of database because it will be really small anyway.
 
I am still trying to fix it, so would appreciate any help I can get.

Many thanks!
 

Users who are viewing this thread

Back
Top Bottom