Question : One to one relationship Access 2003 and a dlookup

Hello,
I have a table called 1CRoster and a table called 1CDaily_Input.  They are both related by a particular ending date and a crew.

The Roster is pre entered and then daily we enter data in the daily form.  After the data has had the the date and crew entered (among other fields), I have a control field with the dlookup:

=DLookUp("[NumberOfMembers]","[1CRoster]","[1CRoster]![RosterDateFinish]=[ShiftDateEnd] AND [1CRoster]![RosterCrew]=[Crew]")

This enters a number of people automatically from the roster into the daily input form, so long as the ending date and crew are equal (because some dates have 8 different crews and 3 different ending times)

This works extremely well, however it does not update until the record is saved and I have left the form and re-opened the form to check it.  I really would like this field to update as soon as I enter the date and crew into the form.

Is it because of my relationship?  Any help would be greatly appreciated.

Thanks

Answer : One to one relationship Access 2003 and a dlookup

"however it does not update until the record is saved"

Well, until the new values are saved in the table(s), it's not going to update.

If you really want an 'instant'  update , then add the following code to the AfterUpdate event of each control where you enter data:

Me.Dirty = False  '  ** save the record
Me.ReCalc           ' ** recalculate the DLookup()

mx

Random Solutions  
 
programming4us programming4us