Help with updating a field value 
Author Message
 Help with updating a field value

I know this is more of a query question but I posted there yesterday and
have not gotten any response.  This group seems multifacited and has always
been responsive.  So here is the question.

After we print an order I move that record to a History Table.  I do some
calculations and input an amout into a field called [OrderTotal]  It appears
that this works (most of the time) but I have some records where the
[OrderTotal] is incorrect.

The history table has fields [WeightChg], [SpecialChg], and [OrderTotal]

I have a related table OrderExtraCharges that contains multiple records that
must be calculated into the [OrderTotal] in the history table.  The field in
this table is called [ResultsChg]

I have created a query that calculates the [NewTotal] that is working
properly
[WeightChg]+[SpecialChg]+[SumOfResultsChg]

I want to go thru each record in the history table and update [OrderTotal]
to the value in my query called [NewTotal].

I know this is probably very easy, but I have been working on it for two
days, and am still not getting it.

Any help would be appreciated.

Thanks in advance



Mon, 12 Apr 2004 21:55:07 GMT  
 Help with updating a field value

Quote:

> I know this is more of a query question but I posted there yesterday and
> have not gotten any response.  This group seems multifacited and has always
> been responsive.  So here is the question.

> After we print an order I move that record to a History Table.  I do some
> calculations and input an amout into a field called [OrderTotal]  It appears
> that this works (most of the time) but I have some records where the
> [OrderTotal] is incorrect.

> The history table has fields [WeightChg], [SpecialChg], and [OrderTotal]

> I have a related table OrderExtraCharges that contains multiple records that
> must be calculated into the [OrderTotal] in the history table.  The field in
> this table is called [ResultsChg]

> I have created a query that calculates the [NewTotal] that is working
> properly
> [WeightChg]+[SpecialChg]+[SumOfResultsChg]

> I want to go thru each record in the history table and update [OrderTotal]
> to the value in my query called [NewTotal].

> I know this is probably very easy, but I have been working on it for two
> days, and am still not getting it.

> Any help would be appreciated.

> Thanks in advance

UPDATE [History Table] AS HT SET [OrderTotal] =
(SELECT [NewTotal] FROM [NewTotal Query] NQ WHERE HT.PrimaryKeyField =
NQ.PrimaryKeyField);

Replace the table names with the correct names, and replace
PrimaryKeyField with the name of the appropriate primary key field.

--
Hope this helps
Tony Oakley (MVP)



Tue, 13 Apr 2004 16:53:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. need help on getting the auto-increment value of a field BEFORE updating recordset

2. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

3. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

4. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

5. Updating field in form from summary value in another

6. Update Field Value

7. Updating Fields with Different Values?

8. Variable and field value changes after .Update in VBA

9. Updating Field Values

10. When value changes, update other field with current date

11. Updating Field Values

12. Updating (Custom) Field Values

 

 
Powered by phpBB® Forum Software