E
elliottpt via AccessMonster.com
Hi
I am having a bit of trouble with a dlookup not functioning properly.
I have a continious form based on a table, tblTFCMASTER, in which I need ot
lookup a value from a query,qryMAXSAILDATANDSAILWEEK. Table TFC master
contains amongst others a text field called SHIPNO, which I want to use to
search for the MAXWEEKNO in the query. The query qryMAXSAILDATANDSAILWEEK is
based on another qry in order to calulate the maximum weekno. The query
contains the following fields(amongst others):SHIPNO, MAXWEEKNO
I have written the following dlookup and placed it in the on load event of
the form to search for the maximum week no and display it in the unbound
field WEEKNO in the form.
Me.WEEKNO = DLookup("[MAXWEEKNO]", "qryMAXSAILDATANDSAILWEEK", "[SHIPNO] ='"
& Me.SHIPNO & "'")
It however only finds(correctly I might add) the first record's MAXWEEKNO and
displays it correctly too, but the problem is it also displays the first
record's MAXWEEKNO now for all the other records too.
It puzzles me as I understand the Me. to use the current records information;
ie the current records SHIPNO as the comparison.
Help will be much appreciated.
Kind regards
Philip
I am having a bit of trouble with a dlookup not functioning properly.
I have a continious form based on a table, tblTFCMASTER, in which I need ot
lookup a value from a query,qryMAXSAILDATANDSAILWEEK. Table TFC master
contains amongst others a text field called SHIPNO, which I want to use to
search for the MAXWEEKNO in the query. The query qryMAXSAILDATANDSAILWEEK is
based on another qry in order to calulate the maximum weekno. The query
contains the following fields(amongst others):SHIPNO, MAXWEEKNO
I have written the following dlookup and placed it in the on load event of
the form to search for the maximum week no and display it in the unbound
field WEEKNO in the form.
Me.WEEKNO = DLookup("[MAXWEEKNO]", "qryMAXSAILDATANDSAILWEEK", "[SHIPNO] ='"
& Me.SHIPNO & "'")
It however only finds(correctly I might add) the first record's MAXWEEKNO and
displays it correctly too, but the problem is it also displays the first
record's MAXWEEKNO now for all the other records too.
It puzzles me as I understand the Me. to use the current records information;
ie the current records SHIPNO as the comparison.
Help will be much appreciated.
Kind regards
Philip