Yes, PK ist the one table's Primary Key. FK is the many
table's Foreign Key field that links back to the one table.
Since you only want to retrieve the minimums for a single PK
value, then the query will be simpler or you could use
another approach.
You can open a recordset on the SQL statement to retrieve
the set of minimums in one operation.
Dim rs As Recordset
strSQL="SELECT Min(field1) As Min1,Min(field2) As Min2," _
& "Min(field3) As Min3,Min(field4) As Min4 " _
& "FROM manytable " _
& "WHERE FK=" & me.txtPK
Set rs = CurrentDb.OpenRecordset(strSQL)
Me.txtMin1 = rs!Min1
Me.txtMin2 = rs!Min2
Me.txtMin3 = rs!Min3
Me.txtMin4 = rs!Min4
Set rs = Nothing
Alternatively, you could use the slower approach of four
operations:
Me.txtMin1 = DMin("field1", "manytable", "FK=" & me.txtPK)
Me.txtMin2 = DMin("field2", "manytable", "FK=" & me.txtPK)
Me.txtMin3 = DMin("field3", "manytable", "FK=" & me.txtPK)
Me.txtMin4 = DMin("field4", "manytable", "FK=" & me.txtPK)
--
Marsh
MVP [MS Access]
I am a little confused...is "pk" the primary key field? How about "fk"? How
will I assign the result (minimum value) to a variable or control. I only
need the minimum from the four fields for the one record of the primary table
I am currently looking at.