Re: the value of the last record
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 10/18/04
- Next message: Chunda: "Access form locks-up during load 1 time out of 10"
- Previous message: Edgar Thoemmes: "Linking sub form with list box"
- In reply to: Liat: "Re: the value of the last record"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 18 Oct 2004 19:11:35 +0800
Normally a subform is bound to a table that is related to the main form's
table. The field in the subform's table that relates to the main form's
table is called the foreign key. Substitute the name of this field in the
expression.
Max() will not work in this context.
If necessary, use the AfterUpdate event of the subform to recalc the main
form. The code for the event procedure would be:
Me.Parent.ReCalc
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Liat" <liat_oren@yahoo.co.uk> wrote in message news:A1BA9614-58DF-408D-8814-3B34E035109F@microsoft.com... > Thank you very much for your answer. > > What is the NameOfSubform'sForeignKey? > > I just used the Max(), what is the difference? > > How can I ReCalc after data was entered? > > Thanks a lot, > Liat > > "Allen Browne" wrote: > >> Use DMax() to lookup the subform's table and get the maximum value of the >> date field. >> >> The ControlSource of the text box on the main form will be: >> =DMax("NameOfDateField", "NameOfSubform'sTable", >> "[NameOfSubform'sForeignKey] = " & Nz([NameOfMainForm'sPrimaryKey], >> 0) >> >> After changes in the subform, you may need to ReCalc the main form (or >> move >> record) before it displays the new value. >> >> "Liat" <liat_oren@yahoo.co.uk> wrote in message >> news:1C3DF292-769E-4DD3-9A4B-B3AF803FF34F@microsoft.com... >> > >> > I have a form and a sub form. >> > One of the fields in the sub forms is date. I have some records in the >> > sub >> > form for each record in the main form (one to many relation) >> > I would like to have the date of the last record of the sub form. >> > >> > How can I get this value? >> > >> > Thanks a lot, >> > Liat
- Next message: Chunda: "Access form locks-up during load 1 time out of 10"
- Previous message: Edgar Thoemmes: "Linking sub form with list box"
- In reply to: Liat: "Re: the value of the last record"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|