speedup macro

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

Guest

Hi
i use the "setvalue" macro to store one calculated field from my form back
to table but the most time it takes so long time to display my calulated data
or it needs to change the record...is there any way to speed up that process ?
 
Vassilis,

This would not normally be the best purpose for a SetValue macro.
Generally, apart from direct data entry via the form, writing data to
the table is best done with an Update Query or an Append Query. To
automate this process with a macro, the OpenQuery action would then be
applicable.

However, this is probably not related to your problem with the slow
response time. I don't think I can comment on this without knowing the
specific details of the actions and arguments in the macro, and which
event the macro is running on.

Having said that, I should also say that, except in very specific
exceptional circumstances, storing a calculated value in a table is
usually a poor decision, and there are usually better ways of handling
this. If you want to explore this aspect further, please let us know
more information about the data you are working with, including
examples, and what you are trying to achieve.
 
hello Steve
the calculated field is a datediff function tha calculate the total
travelling between date1=arrival date and date2 = departure date...
I need to store that information because i use it to calculate the total day
out per employed and unfortunatly functions doesnt work on unsaved data...(i
learn it resently :) ).
so i made the setvalue macro with the datediff expression and its a little
annoying to change the record in order the value to get stored...
 
Vassilis,

You should not be saving this calculated value to the table. Absolutely
not. Sorry. If you need to see it on your form or report, you can use
a calculation in the control source of a textbox on the form or report,
or else calculate it in the query that the form or report is based on.
If you need it as the basis of further calculations, such as summary
totals or averages or whatever, it should be calculated as you need it.
Saving redundant data is not how databases work best.
 
Back
Top