Updating txt box

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

Guest

On a form there is a combo box. In that there are table names. Once the
user selects the table they want, a BASIC instruction executes on the
AfterUpdate command. Here a query is generated from the corresponding table
selected. This query holds about 3000 records, corresponding to data taken
from sensors.

From that query, a totals query runs selecting the Min, Max and Avg for one
of the fields on the entire table.

I have text boxes that is supposed to update with the new avg/min/max
values. however when the event runs, i get a "#Name?" in the text box. I
used the expression builder to select the proper field from the right query.

my thiniking is that there isn't enough time between the start of the
queries and the selection of the data. is there a way to pause the VB code
to allow the queries to run, therefore setting the proper data in the
recordset?
 
why not make your life a lot easier and use DMAX or DMIN or whatever?
If you have to use a query, you could open a recordset based on your
summary query and then plonk the values in that way using something
like

rs.Fields("FieldName")

check out the domain aggregate functions in the help. Sorry, but what
you're trying to do can't be done the way you're trying to do it.
 
Ok, i'll try that. i'm new to databases so i'm trying just to go along.
 
ok, i'm getting a runtime error of 2498, updating fields of different
datatypes, or something like that. but the aggregrate functions are working
great.

What i'd really like to do is do a math calculation in VB to manually
calculate the max/min/avg.

now, here's the setup. There is a main table, 'Coils' that contains
information about each specific coil. There is a field, "CoilID" that is the
name of another table (same value). This table Contains Different data
points gathered during the rolling of the coil. On the form is a combo box
with the "CoilID" field as the source data. When an ID is selected, an SQL
statment is formed gathering different fields from the table the CoilID is
named from.

What i want to do is take the first record, set a max and min value. Then
Start a running total and count variables. Then the next record is analyzed,
updating the max and min, if they need changed. The running total gets the
data added to it, and the count increases. after the last record, the avg is
calculated by runningtotal divided by count. Now the min/max/avg would be
shown in a text box on the form.

Is that possible?
 

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

Back
Top