Change data source with code based on field focus

D

Dan

I have a form that displays Min and Max values in separate fields for
whichever field has the focus. There are about two dozen fields total,
therefore two dozen Min and Max value fields stacked on top of one another.
Using the got and lost focus events I make the Min and Max fields visible or
not visible, which works but feels very clumsy.

Is it possible to have a single Min value and Max Value field and via code
change the data source in order to link the Min and Max values to whichever
field has the focus?
 
T

Tim Ferguson

Is it possible to have a single Min value and Max Value field and via
code change the data source in order to link the Min and Max values to
whichever field has the focus?

What is the table structure?

Tim F
 
D

Dan

The table structure is fairly simple:

[Field name] (data type = number)
For example: [Stage 1 vibration]
Daily readings are taken, charted, averaged and min and max values are
determined for a given time period
 
T

Tim Ferguson

What is the table structure?
The table structure is fairly simple:

[Field name] (data type = number) For example: [Stage 1 vibration]
Daily readings are taken, charted, averaged and min and max values are
determined for a given time period


I think we must be at cross purposes. I was imagining something along the
lines of

ReadingTypes(*TypeCode, Description, Units, Display, etc)

Readings(*DateTaken, *RType, Value, Notes, etc)

so you can read the min and max with simple functions like

DMax("Value", "Readings", "RType=""S1vib"" " & _
"AND DateTaken >= #2005-06-01# " & _
"AND DateTaken < #2005-07-01#")

and mean is

DSum("Value", "Readings", "RType=""S1vib"" " & _
"AND DateTaken >= #2005-06-01# " & _
"AND DateTaken < #2005-07-01#") / _
DCount("*", "Readings", "RType=""S1vib"" " & _
"AND DateTaken >= #2005-06-01# " & _
"AND DateTaken < #2005-07-01#")

and so on. But this is all guess work without knowing how you are
actually structuring your data.

Hope it helps


Tim F
 
D

Dan

Maybe this clarifies what I am looking for an answer to:

I want a single text box to show a Max value based on whichever
[Readingfield] has the focus.
For instance:

1. User has set focus on [stage 1 vibration], [Maxtxt] shows the max value
for "stage 1 vibration" for the time period being viewed.

2. User tabs to next field and focus is set on [Stage 2 vibration] with
[Maxtxt] now showing the max value for "Stage 2 Vibration" for the time
period being viewed.

Currently I am using multiple [Maxtxt_Readingname] boxes and setting the
visibility to either "TRUE" or "FALSE" based on field focus. While this does
work it is cumbersome and time consuming to set up. I was hoping there was
an easier way to set the datasource within code so I did not have to play
hide and seek.

As far as the date range, it is set upon form opening and not required for
this question of mine.
Tim Ferguson said:
Is it possible to have a single Min value and Max Value field and
via code change the data source in order to link the Min and Max
values to whichever field has the focus?


What is the table structure?
The table structure is fairly simple:

[Field name] (data type = number) For example: [Stage 1 vibration]
Daily readings are taken, charted, averaged and min and max values are
determined for a given time period


I think we must be at cross purposes. I was imagining something along the
lines of

ReadingTypes(*TypeCode, Description, Units, Display, etc)

Readings(*DateTaken, *RType, Value, Notes, etc)

so you can read the min and max with simple functions like

DMax("Value", "Readings", "RType=""S1vib"" " & _
"AND DateTaken >= #2005-06-01# " & _
"AND DateTaken < #2005-07-01#")

and mean is

DSum("Value", "Readings", "RType=""S1vib"" " & _
"AND DateTaken >= #2005-06-01# " & _
"AND DateTaken < #2005-07-01#") / _
DCount("*", "Readings", "RType=""S1vib"" " & _
"AND DateTaken >= #2005-06-01# " & _
"AND DateTaken < #2005-07-01#")

and so on. But this is all guess work without knowing how you are
actually structuring your data.

Hope it helps


Tim F
 
T

Tim Ferguson

Maybe this clarifies what I am looking for an answer to:

Not really: without knowing your table and field structure, it's not
possible to give a precise answer.

Sorry... I don't have Windows Telepathy Extensions loaded here!

B Wishes


Tim F
 

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