Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Updating entire record set

Status
Not open for further replies.

kermitforney

Technical User
Mar 15, 2005
374
US
I am attempting to update a column for an entire recordset. I have the code to update the record that has focus, but not the entire record set.

Any and all help is greatly appreciated.

Thanks in advance,

Code:
Private Sub cmdForecastReset_Click()

Dim AvgShipped As Integer

Me![FrmRptBuyingForecasting_ItemData].SetFocus
Me![FrmRptBuyingForecasting_ItemData].Form![FutureForecast1].SetFocus
Me![FrmRptBuyingForecasting_ItemData].Form![Avg. Shipped last 4 weeks].SetFocus
AvgShipped = Me![FrmRptBuyingForecasting_ItemData].Form![Avg. Shipped last 4 weeks]
Me![FrmRptBuyingForecasting_ItemData].Form![FutureForecast1].Value = AvgShipped

End Sub
 
Why not use an Update query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
really you should treat it as a calculated field

=DAvg("fieldname","[tablename]","[date] between now() and now()-28)

basically this reads Average your field(all records) from your table where your date is between now and -28days(4weeks - last 4 weeks)



HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
Sorry syntax error

=DAvg("fieldname","[tablename]","[date] between now() and now()-28[red]"[/red])

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top