T
Tony Williams
I have a form where I want to populate a control [txtbusinessnamea] based on
the content of either of two other controls [txtmemnbr] and
[txtempmemnumbera]. If neither of the latter controls have data, then I want
the first control to be blank. So a series of lookup statments may look like
this;
IF (IsNotNull([txtmemnbr]) and
IsNull([txtempmemnumbera]),DLookUp("[txtbusinessname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1![txtmemnbr]"),"
") Else
IF (IsNotNull([txtempmemnumbera] and IsNull([txtmemnbr])
,DLookUp("[txtbusinessname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1![txtempmemnumbera]"),"
") Else
IF IsNull([txtmemnbr]) and IsNull([txtempmemnumbera]), then
txtbusinessnamea is blank
I realise I haven't got the syntax correct but this is just to illustrate
what I'm trying to do.
Could someone start me off with the VBA code, or an IIF statement to produce
the result I want please, but care because I am a novice<g>
Many thanks
Tony
the content of either of two other controls [txtmemnbr] and
[txtempmemnumbera]. If neither of the latter controls have data, then I want
the first control to be blank. So a series of lookup statments may look like
this;
IF (IsNotNull([txtmemnbr]) and
IsNull([txtempmemnumbera]),DLookUp("[txtbusinessname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1![txtmemnbr]"),"
") Else
IF (IsNotNull([txtempmemnumbera] and IsNull([txtmemnbr])
,DLookUp("[txtbusinessname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1![txtempmemnumbera]"),"
") Else
IF IsNull([txtmemnbr]) and IsNull([txtempmemnumbera]), then
txtbusinessnamea is blank
I realise I haven't got the syntax correct but this is just to illustrate
what I'm trying to do.
Could someone start me off with the VBA code, or an IIF statement to produce
the result I want please, but care because I am a novice<g>
Many thanks
Tony