Min/Max Records From a sub form (1 Viewer)

redlich23

New member
Local time
Today, 07:02
Joined
Aug 20, 2009
Messages
5
I was wondering if someone could help me with a min/max issue. I have a form that also contains a subform. The sub form is displaying all records from a master table that are 10 min before and 10 min after the current record on the main form based off a field called time. This works fine.

However, on this sub form, there is a field called price. What I am having trouble doing is getting the min and max records for all the entries that are returned on the sub form and display them on the master form.

any ideas? Thanks in advance for your help!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:02
Joined
Aug 30, 2003
Messages
36,128
If the subform is based on a query, you could use a DMin() and DMax() on that query. Even if it isn't, you could probably come up with a criteria that got the appropriate values.
 

redlich23

New member
Local time
Today, 07:02
Joined
Aug 20, 2009
Messages
5
The subform is based on a query. I was looking at the DMin and DMax but I tried several variations and was unable to get a appropriate ansewer. I put a text box on the main form and used the following as the control source but it didnt work. I am sure I am doing something wrong

=DMin(Price,frmQuery1Data.Form!Price)
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:02
Joined
Aug 30, 2003
Messages
36,128
Try

=DMin("Price", "QueryName")

The quotes are necessary.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:02
Joined
Aug 30, 2003
Messages
36,128
No problem, and welcome to the site by the way!
 

redlich23

New member
Local time
Today, 07:02
Joined
Aug 20, 2009
Messages
5
This worked perfectly but now I need to compare the DMIN and DMAX numbers to a value on the main form. I need to do this for all 1127 records in the record set. Obviusly I dont want to click through all records one by one. Is there a way to run a query to do this?
 

Users who are viewing this thread

Top Bottom