From: JOSELUIS via AccessMonster.com on 19 Mar 2010 14:46 This is the code: Private Sub Form_Current(Cancel as Integer) If Me.NewRecord = False Then If Not IsNull(DLookUp("MemberID", "DrivingLicenses", _ "[MemberID] = " & Me.MemberID & _ " AND EndDate < DateAdd('m', 6, Date())") Then Me!lblExipring.Caption = "LICENSE EXPIRING SOON" Me!lblExpiriing.ForeColor = vbRed Else Me!lblExpiring.Caption = "License OK" Me!lblExpiring.ForeColor = vbBlack End If End If End Sub I made a mistake becuse i thought that "DrivingLicenses" was refered to a field of the subform not a table . My table was named tblDrivingMembers so I corrected the name of the table and now it works perfectly.Thank you very much for your time again. John W. Vinson wrote: >>I´m really sorry but maybe I don´t explain myself correctly and therefore an >>error message is displayed in the code and in english is more or less that >[quoted text clipped - 5 lines] >>have to explain a little more in the expression DLookUp( "MemberID", >>"DrivingID"... > >The second argument of DLookUp should not be DrivingID, but should instead be >the name of a table. > >You chose not to post your actual code so obviously I can't tell you what you >did wrong. If you would copy and paste the code to a message here someone >should be able to help correct it. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access/201003/1
First
|
Prev
|
Pages: 1 2 Prev: Save a record when switching tabs or clicking button Next: Set Value Macro |