how 2 make Temp table

  • Thread starter Thread starter wirelad
  • Start date Start date
W

wirelad

Hello,
Its was recommended to me - I make a temp table to store some field data
in.

How do you make a temp table?

I have a form that calculates data and I'm trying to create a chart based on
this data.
The problem is, you can only create a chart from a table or query.
SO!
How can I send data back to a table from a form - only for the current form
data.

Please - anyone any ideas...HELP!

Sorry

WiReLaD
 
Why not calculate those values in a query instead, and then make your chart
from there?

Rick B
 
Rick - yeah good point!

HOW!

The calculations are only created once the form is run and a product is
selected
from the combo box. Once the form refreshes - the calculations are done.

I just need to know, how do I send 5 of the 30 calculated cells back to a
table or
query so I can use this data for my chart.

WiReLaD
 
Rick - yeah good point!

HOW!

The calculations are only created once the form is run and a product is
selected
from the combo box. Once the form refreshes - the calculations are done.

I just need to know, how do I send 5 of the 30 calculated cells back to a
table or
query so I can use this data for my chart.

WiReLaD
 
Tell us what you are trying to accomplish, not what you have tried so far.

What data do you have, what calculations do you wish to perform?

Rick B
 
Rick,

In my form I have a combo that list product names. Once a product is
selected - Other text boxes are up-dated. Once these textboxes are
up-dated. I then have label fields that get populated based on calcs from
these text.boxes.

The form then calculates other, none bound label boxes with other
calculations.
These are not bound and are not stored anywhere - Just calculated based on
other numbers created by the selection.

These are the feilds/label boxes I need to create my chart from.

Thanks for you help Rick.

Mike
 
wirelad said:
Hello,
Its was recommended to me - I make a temp table to store some field data
in.

How do you make a temp table?

I have a form that calculates data and I'm trying to create a chart based on
this data.
The problem is, you can only create a chart from a table or query.
SO!
How can I send data back to a table from a form - only for the current form
data.

Please - anyone any ideas...HELP!

Sorry

WiReLaD
To answer your original question.

Create the temporary tables just like you would create any other table.
They call these temporary table because the data in the table is temporary.

Then in your code do the following to delete all of the records in the
two tables

Dim dbs As Database
Dim SQLString as string

Set dbs = CurrentDb
dbs.Execute "DELETE * FROM tmpTable1;"
dbs.Execute "DELETE * FROM tmpTable2;"

Then in your code when it is time to add data to the tables, do the
following


SQLString = "INSERT INTO tmpTable1 ( TableFieldName1, TableFieldName2)"
SQLString = SQLString & " VALUES (" & Me!LabelValue1.Caption & ", " &
Me!LabelValue2.Caption & ");"
dbs.Execute SQLString

After the two SQLString assignment statements have executed, you will
have one long string of
concatenated information, the keywords for the INSERT instruction and
the variable data from
your Form for the data being inserted into the table.

What other are trying to tell you is:
1. In these Newsgroups a request for an answer needs to be explained in
some detail and be clear.
This will allow others the ability to answer your question without
all of the
What-do-you-mean-by type of replies.
2. It also allows others the option of giving you another approach or a
better approach to solving
your problem.

Hope this helps.

Ron
ps: This is air code.
 
Thanks Ronald / Rick B

Ive solved it now but a lot more long winded than you two sugested (but at
least it works and I did it ;)

I used Access VBA to manually create a table to store my temp data.

Thanks for the SQL examples, Ill work them in when i get time, as they are
obviously much more efficient than my code..



Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
With rst
.Open "tblChartDataTMP", _
ActiveConnection:=cnn, _
CursorType:=adOpenKeyset, _
LockType:=adLockOptimistic, _
Options:=adCmdTableDirect

' delete all existing temp data
While Not .EOF
.Delete
.Update
.Requery
Wend

' add the new data
.AddNew

!KGs = Label81
!Ltrs = Label88
!Silverson = Label95
!Bottom = Text137
!Top = Text138
!Overflow = Overflow
.Update
End With
Me.Refresh ' refreshes the chart object
 
Back
Top