updating records

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

Guest

I have a continuous subform which shows when different stages of jobs are
due. This subform is linked to the main form by Job Number. The query behind
the subform is DateDue:[DateStarted]+[TimeAllowed]. Obviously, this form only
does the calculation but I need the table to be updated with the DateDue. Is
there anyway (besides an Update Query) to store the calculated info in the
table.
 
See:
Calculated fields
at:
http://allenbrowne.com/casu-14.html

The article explains that the DueDate should not be stored in its own field,
unless you need the flexibility to set a DueDate that does not match the
DateStarted+TimeAllowed. It also explains how to use the AfterUpdate events
to assign the value.
 
Allen, I can't get it to work. I get an error message and the top line is
highlighted in yellow and the second line has the .FEE=Round highlighted in
blue.

Any ideas?

Private Sub DateStarted_AfterUpdate()

Me.Fee = Round(Me.DateStarted * Me.TimeAllowed * 0.1, 2)


Allen Browne said:
See:
Calculated fields
at:
http://allenbrowne.com/casu-14.html

The article explains that the DueDate should not be stored in its own field,
unless you need the flexibility to set a DueDate that does not match the
DateStarted+TimeAllowed. It also explains how to use the AfterUpdate events
to assign the value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bill Neilsen said:
I have a continuous subform which shows when different stages of jobs are
due. This subform is linked to the main form by Job Number. The query
behind
the subform is DateDue:[DateStarted]+[TimeAllowed]. Obviously, this form
only
does the calculation but I need the table to be updated with the DateDue.
Is
there anyway (besides an Update Query) to store the calculated info in the
table.
 
I don't follow that calcuation, Bill.

You are multiplying the DateStarted value (which will be something like
38932 if it is today) by the TimeAllowed value (what's this: days?
minutes?), dividing by 10, rounding to 2 decimal places, and assigning the
result to a Fee field. So if the TimeAllowed is 10 (whatevers), the fee
would be $38,932 today?

In the VBA window, you could try Compile on the Debug menu to see if Access
can make sense of it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bill Neilsen said:
Allen, I can't get it to work. I get an error message and the top line is
highlighted in yellow and the second line has the .FEE=Round highlighted
in
blue.

Any ideas?

Private Sub DateStarted_AfterUpdate()

Me.Fee = Round(Me.DateStarted * Me.TimeAllowed * 0.1, 2)


Allen Browne said:
See:
Calculated fields
at:
http://allenbrowne.com/casu-14.html

The article explains that the DueDate should not be stored in its own
field,
unless you need the flexibility to set a DueDate that does not match the
DateStarted+TimeAllowed. It also explains how to use the AfterUpdate
events
to assign the value.

Bill Neilsen said:
I have a continuous subform which shows when different stages of jobs
are
due. This subform is linked to the main form by Job Number. The query
behind
the subform is DateDue:[DateStarted]+[TimeAllowed]. Obviously, this
form
only
does the calculation but I need the table to be updated with the
DateDue.
Is
there anyway (besides an Update Query) to store the calculated info in
the
table.
 
I might try another tack. What I really want is for the form to open showing
the latest stage of each job which is due.
And I worked out what to put in the query ... it finally works.

This form is simply a warning of impending dates.
I am using the code I got from you the other day re not opening if no data,
but now how do I get the form to open on start up with out using a macro or
the startup menu (I have another form opening on startup)



Allen Browne said:
I don't follow that calcuation, Bill.

You are multiplying the DateStarted value (which will be something like
38932 if it is today) by the TimeAllowed value (what's this: days?
minutes?), dividing by 10, rounding to 2 decimal places, and assigning the
result to a Fee field. So if the TimeAllowed is 10 (whatevers), the fee
would be $38,932 today?

In the VBA window, you could try Compile on the Debug menu to see if Access
can make sense of it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bill Neilsen said:
Allen, I can't get it to work. I get an error message and the top line is
highlighted in yellow and the second line has the .FEE=Round highlighted
in
blue.

Any ideas?

Private Sub DateStarted_AfterUpdate()

Me.Fee = Round(Me.DateStarted * Me.TimeAllowed * 0.1, 2)


Allen Browne said:
See:
Calculated fields
at:
http://allenbrowne.com/casu-14.html

The article explains that the DueDate should not be stored in its own
field,
unless you need the flexibility to set a DueDate that does not match the
DateStarted+TimeAllowed. It also explains how to use the AfterUpdate
events
to assign the value.

I have a continuous subform which shows when different stages of jobs
are
due. This subform is linked to the main form by Job Number. The query
behind
the subform is DateDue:[DateStarted]+[TimeAllowed]. Obviously, this
form
only
does the calculation but I need the table to be updated with the
DateDue.
Is
there anyway (besides an Update Query) to store the calculated info in
the
table.
 
Perhaps you could put some code into the Open event of your other form so it
loads this one too:

DoCmd.OpenForm "Form2"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bill Neilsen said:
I might try another tack. What I really want is for the form to open
showing
the latest stage of each job which is due.
And I worked out what to put in the query ... it finally works.

This form is simply a warning of impending dates.
I am using the code I got from you the other day re not opening if no
data,
but now how do I get the form to open on start up with out using a macro
or
the startup menu (I have another form opening on startup)



Allen Browne said:
I don't follow that calcuation, Bill.

You are multiplying the DateStarted value (which will be something like
38932 if it is today) by the TimeAllowed value (what's this: days?
minutes?), dividing by 10, rounding to 2 decimal places, and assigning
the
result to a Fee field. So if the TimeAllowed is 10 (whatevers), the fee
would be $38,932 today?

In the VBA window, you could try Compile on the Debug menu to see if
Access
can make sense of it.

Bill Neilsen said:
Allen, I can't get it to work. I get an error message and the top line
is
highlighted in yellow and the second line has the .FEE=Round
highlighted
in
blue.

Any ideas?

Private Sub DateStarted_AfterUpdate()

Me.Fee = Round(Me.DateStarted * Me.TimeAllowed * 0.1, 2)


:

See:
Calculated fields
at:
http://allenbrowne.com/casu-14.html

The article explains that the DueDate should not be stored in its own
field,
unless you need the flexibility to set a DueDate that does not match
the
DateStarted+TimeAllowed. It also explains how to use the AfterUpdate
events
to assign the value.

message
I have a continuous subform which shows when different stages of
jobs
are
due. This subform is linked to the main form by Job Number. The
query
behind
the subform is DateDue:[DateStarted]+[TimeAllowed]. Obviously, this
form
only
does the calculation but I need the table to be updated with the
DateDue.
Is
there anyway (besides an Update Query) to store the calculated info
in
the
table.
 
Allen, thanks for your advice and patience.

I had already tried that and it works well except that my "Popup" form opens
behind the main and therefore isn't obvious.

Being a warning it needs to be upfront.

Allen Browne said:
Perhaps you could put some code into the Open event of your other form so it
loads this one too:

DoCmd.OpenForm "Form2"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bill Neilsen said:
I might try another tack. What I really want is for the form to open
showing
the latest stage of each job which is due.
And I worked out what to put in the query ... it finally works.

This form is simply a warning of impending dates.
I am using the code I got from you the other day re not opening if no
data,
but now how do I get the form to open on start up with out using a macro
or
the startup menu (I have another form opening on startup)



Allen Browne said:
I don't follow that calcuation, Bill.

You are multiplying the DateStarted value (which will be something like
38932 if it is today) by the TimeAllowed value (what's this: days?
minutes?), dividing by 10, rounding to 2 decimal places, and assigning
the
result to a Fee field. So if the TimeAllowed is 10 (whatevers), the fee
would be $38,932 today?

In the VBA window, you could try Compile on the Debug menu to see if
Access
can make sense of it.

Allen, I can't get it to work. I get an error message and the top line
is
highlighted in yellow and the second line has the .FEE=Round
highlighted
in
blue.

Any ideas?

Private Sub DateStarted_AfterUpdate()

Me.Fee = Round(Me.DateStarted * Me.TimeAllowed * 0.1, 2)


:

See:
Calculated fields
at:
http://allenbrowne.com/casu-14.html

The article explains that the DueDate should not be stored in its own
field,
unless you need the flexibility to set a DueDate that does not match
the
DateStarted+TimeAllowed. It also explains how to use the AfterUpdate
events
to assign the value.

message
I have a continuous subform which shows when different stages of
jobs
are
due. This subform is linked to the main form by Job Number. The
query
behind
the subform is DateDue:[DateStarted]+[TimeAllowed]. Obviously, this
form
only
does the calculation but I need the table to be updated with the
DateDue.
Is
there anyway (besides an Update Query) to store the calculated info
in
the
table.
 
If it's a warning that needs to be heeded before anything else happens, you
could use:
DoCmd.OpenForm "Form2", WindowMode:=acDialog
 
Back
Top