Auto Calculate Form

B

BMaerhofer

Here is my situation:

I have two forms: frmInputRecord and frmAuto

I need for when a user inputs mileage it will look at another field for the
interval to update the next oil change.

-------------------------------
frmInputRecord (Table: tblRecords)
Mileage
Next_Oil_Change

frmAuto (Table: tblAuto)
Change Interval
-------------------------------
So:
Mileage + Change Interval = Next_Oil_Change


Auto Fill: Next_Oil_Change based on the interval that was set.

Thanks!!!
Brian
 
A

AkAlan via AccessMonster.com

First of all most people will tell you not to store a value that can be
created at any time you need it.
But if you really need/want to store a calculated valu you might look up the
sql UPDATE statement in ACCESS help.
 
B

BMaerhofer

Ok Thanks!
But I still can't figure it out.

Private Sub Mileage_AfterUpdate()
Update tblRecords

Set Next_Oil_Change = Mileage + 4000

End Sub

It will not work.

THANKS!
 
A

AkAlan via AccessMonster.com

You need to do more research on creating sql statements. here is a quick
example

dim strSql as string

strSql = "UPDATE tblRecords SET Next_Oil_Change = " & Mileage + 4000 _
& " WHERE VehicleId = " & txtVehicleId

DoCmd.RunSQL "strSql"
Ok Thanks!
But I still can't figure it out.

Private Sub Mileage_AfterUpdate()
Update tblRecords

Set Next_Oil_Change = Mileage + 4000

End Sub

It will not work.

THANKS!
First of all most people will tell you not to store a value that can be
created at any time you need it.
[quoted text clipped - 23 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top