Prev: input a comma after 2 digits
Next: opeing excel
From: deb on 23 Mar 2010 08:58 Access 2003 On the form called fClosure ApprovalPopUp I have a combobox called SignaturePM. The default value for SignaturePM is currently =DLookUp("[ContactPMID]","[t040Project]","[ProjectID] =" & [Forms]![fClosure]![ProjectID]) How do I edit the above DLookUP to this... =if LoginUser = PMUser then DLookUp("[ContactPMID]","[t040Project]","[ProjectID] =" & [Forms]![fClosure]![ProjectID]) if LoginUser = ManagerUser then DLookUp("[ContactPMgrID]","[t040Project]","[ProjectID] =" & [Forms]![fClosure]![ProjectID]) End if End if I get invalid syntax error if I use this in the Default Value area. Thank you, -- deb
From: Daryl S on 23 Mar 2010 09:25 Deb - Assuming you know if the LoginUser is PMUser or ManagerUser when the form is first opened, then use the form's Load event to set the default value. This example uses a simple if/then/else. If you have more than two LoginUsers, then you can put this into a case statement. If LoginUser = PMUser Then Me.SignaturePM.DefaultValue = DLookUp("[ContactPMID]","[t040Project]","[ProjectID] =" & [Forms]![fClosure]![ProjectID]) Else Me.SignaturePM.DefaultValue = DLookUp("[ContactPMgrID]","[t040Project]","[ProjectID] =" & [Forms]![fClosure]![ProjectID]) End If -- Daryl S "deb" wrote: > Access 2003 > > On the form called fClosure ApprovalPopUp I have a combobox called > SignaturePM. > The default value for SignaturePM is currently > =DLookUp("[ContactPMID]","[t040Project]","[ProjectID] =" & > [Forms]![fClosure]![ProjectID]) > > How do I edit the above DLookUP to this... > =if LoginUser = PMUser then > DLookUp("[ContactPMID]","[t040Project]","[ProjectID] =" & > [Forms]![fClosure]![ProjectID]) > if LoginUser = ManagerUser then > DLookUp("[ContactPMgrID]","[t040Project]","[ProjectID] =" & > [Forms]![fClosure]![ProjectID]) > End if > End if > > I get invalid syntax error if I use this in the Default Value area. > Thank you, > > -- > deb
|
Pages: 1 Prev: input a comma after 2 digits Next: opeing excel |