How to detect data in a form field

S

Sarah Bendele

I have a continuous form which is only used to display
the data from the background query. In the form footer,
there is a text box which sums one column of data. I
need to detect when that text box is populated so I can
trigger a calculation from that sum.

I've tried on_dirty, Render, On_change, After-update and
nothing is working. Has anyone seen this and/or have a
different solution?
 
R

Reggie

Sarah, If you have 2 calculated controls in your footer, I'll name them
txtSumCost and txtSumQty, with the control sources set to something like
this(different names of course)

=Sum(Nz([CostField],0))
=Sum(Nz([QtyField],0))

These controls will always automatically update when you change the values
of your field or add new records etc. Now if you have another calculated
control in your footer that is referencing theses 2 calculated controls, it
too will automatically update. So if txtSumCost = 200 and txtSumQty = 4 and
you have the following as the control source for another calculated control
in your footer, I'll name it txtTotalCost, then it will calculate for you.

=[txtSumCost]*[txtSumQty] will equal 800

Hope this helps!
 
S

Sarah

I guess I didn't make myself clear enough. I have to
detect when there is data in that SUM field, so that I
can save that value, and use it to then trigger another
form to open and calculate with that value.

The entire issue is that I have no event to use to
trigger anything. I can't detect when that SUM field is
finished (ie the entire form is loaded and all data is
summed).
-----Original Message-----
Sarah, If you have 2 calculated controls in your footer, I'll name them
txtSumCost and txtSumQty, with the control sources set to something like
this(different names of course)

=Sum(Nz([CostField],0))
=Sum(Nz([QtyField],0))

These controls will always automatically update when you change the values
of your field or add new records etc. Now if you have another calculated
control in your footer that is referencing theses 2 calculated controls, it
too will automatically update. So if txtSumCost = 200 and txtSumQty = 4 and
you have the following as the control source for another calculated control
in your footer, I'll name it txtTotalCost, then it will calculate for you.

=[txtSumCost]*[txtSumQty] will equal 800

Hope this helps!

--
Reggie

----------
I have a continuous form which is only used to display
the data from the background query. In the form footer,
there is a text box which sums one column of data. I
need to detect when that text box is populated so I can
trigger a calculation from that sum.

I've tried on_dirty, Render, On_change, After-update and
nothing is working. Has anyone seen this and/or have a
different solution?


.
 
K

Ken Snell

Sarah-

Let me suggest that you step back and rethink what you're wanting to do.
There is no specific event that will tell you that the SUMming textbox has a
value in it, although you can run code to test the value that is in the
textbox.

However, you state that you're running a query and that when the query is
done the SUMming textbox has a value in it. So, how are you executing the
query? Is it possible to run your "ending" code when that query is done - or
after the code step that runs the query?

I recommend that you change the focus of your efforts to an action that you
can "track" and/or "trap". As you've noted, a textbox that has a calculated
expression as its control source does not "trigger" any events as its value
is updated; however, that textbox is updated by other events on the form.

--

Ken Snell
<MS ACCESS MVP>

Sarah said:
I guess I didn't make myself clear enough. I have to
detect when there is data in that SUM field, so that I
can save that value, and use it to then trigger another
form to open and calculate with that value.

The entire issue is that I have no event to use to
trigger anything. I can't detect when that SUM field is
finished (ie the entire form is loaded and all data is
summed).
-----Original Message-----
Sarah, If you have 2 calculated controls in your footer, I'll name them
txtSumCost and txtSumQty, with the control sources set to something like
this(different names of course)

=Sum(Nz([CostField],0))
=Sum(Nz([QtyField],0))

These controls will always automatically update when you change the values
of your field or add new records etc. Now if you have another calculated
control in your footer that is referencing theses 2 calculated controls, it
too will automatically update. So if txtSumCost = 200 and txtSumQty = 4 and
you have the following as the control source for another calculated control
in your footer, I'll name it txtTotalCost, then it will calculate for you.

=[txtSumCost]*[txtSumQty] will equal 800

Hope this helps!

--
Reggie

----------
I have a continuous form which is only used to display
the data from the background query. In the form footer,
there is a text box which sums one column of data. I
need to detect when that text box is populated so I can
trigger a calculation from that sum.

I've tried on_dirty, Render, On_change, After-update and
nothing is working. Has anyone seen this and/or have a
different solution?


.
 

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