Update a field in a query

Skip Bisconer

Who Me?
Local time
Today, 13:12
Joined
Jan 22, 2008
Messages
285
I have tried to do this with no success so I am wondering if it is even possible. Can you update a field in a query from a textbox on a form?
 
If the field is part of your recordsource then Yes.

But to answer your question more fully I would need more information.
 
I have a table tha holds inventory data, some of which is, Line Point, Order Point,Econoic Order Quatnity and Recommended Buy qutantitiest that part of some computations using the average of the last 8 month units sold amounts. Of course this rotates to a new average depending on the month the buyer is viewing the table.

I tried using all the computations in the make table query but I can't figure out how to pick up the correct monthly average for those lines that have sales from the query that holds the January through December unit averages.

This is the only computation out of 6 that I can't get in the query. So now I am looking a using a form on the table or query and using a VBA function to address the correct months average when the form opens. Then I was thinking maybe I can use a VBA function in the make table query, but I don't know if thats possible either.

I need the make table query because eventually I will be using this on a link table from another database that is updated daily. If I could get the function in the query that would be, at least, one of the solutions to making this work.

I hope I am clear enough here for you to help me. I appreciate any advice give.
 
There are two ways you could go.

with a query you need three fields.

The first would use the DSum function with a where clause to Sum the records where the Date is greater than today - 8 months.

the second would use the DCount function with the same where clause.

the third would be the first divided by the second.

The other approach would be to use code and loop through the records with one variable counting the records and another to sum the records.

I would tend to go with the Code as the Domain Functions can be a little slower than code.
 

Users who are viewing this thread

Back
Top Bottom