report to table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report in which i calculate a running sum. I want to be able to
copy that into a Table. The Report will only result in one line always. I
have a "Temp" Global Variable setup which saves it.

On a form i can just use Tcost.value = temp and it updates it, but it does
not work in the report. Since i save it in a global variable i can use it
anywhere.

What would be the best way to insert that into the table? I am thinking
maybe and SQL statment?

~Daniel
 
TheGerman said:
I have a report in which i calculate a running sum. I want to be able
to copy that into a Table. The Report will only result in one line
always. I have a "Temp" Global Variable setup which saves it.

On a form i can just use Tcost.value = temp and it updates it, but it
does not work in the report. Since i save it in a global variable i
can use it anywhere.

What would be the best way to insert that into the table? I am
thinking maybe and SQL statment?

~Daniel

I is almost always a bad idea to store a computed number. While you
could do what you want with a query, why do it? Access can recompute the
number faster that storing and recalling it. If you do store it and if
there is a change in any of the numbers making it up then the sum will then
be wrong. If you compute as you use it it will automatically be updated.
 
I already wrote an automatic update function, so that is no problem. I put
way to much time into this already to change it. I am almost done. All i
ned now is to store these values in the able and i'm set!

~Daniel
 
I guess i'm looking for something like this:

strsql = "Update assemblies set tcost = temp Where Parentid = myvalue"
CurrentDb.Execute strsql, dbFailOnError

where assemblies is my table and tcost is the field in the table and temp is
a global variable i want to assign tcost to and parentid is a field in the
table and myvalue is another varible which i am comparing parentid to.
instead of my value i could use rst.Fields("Parentid").Value to get the
right answer

I get an error when trying to run it

"Run-time error '3061':

To few paramters. expected 2.

Hope u can help i'm guessing i'm just using wrong syntax
 
I guess i'm looking for something like this:

strsql = "Update assemblies set tcost = temp Where Parentid = myvalue"
CurrentDb.Execute strsql, dbFailOnError

where assemblies is my table and tcost is the field in the table and temp is
a global variable i want to assign tcost to and parentid is a field in the
table and myvalue is another varible which i am comparing parentid to.
instead of my value i could use rst.Fields("Parentid").Value to get the
right answer

I get an error when trying to run it

"Run-time error '3061':

To few paramters. expected 2.

Hope u can help i'm guessing i'm just using wrong syntax

Assuming Temp and ParentID are Number datatypes.

strsql = "Update assemblies set tcost = " & temp & " Where Parentid =
" & myvalue & ";"
 
Thanx, it seems to almost work. temp is set as a double because i need the
decimals, but myvalue is a string

values for myvalue may include:

001551
c12459
2525dgb

how would i accomidate that?
 
strsql = "Update assemblies set tcost = " & temp & " Where Parentid = '" &
myvalue & "'"
CurrentDb.Execute strsql, dbFailOnError

i used that and it worked great. Thank you very much for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top