Forum Discussion

BobThomas1's avatar
BobThomas1
Qrew Cadet
2 years ago

If statement if 'Work Email' Field is blank...

If statement if 'Work Email' Field is blank... in the Extensions table is blank, when I go to add a new extension the 'Related Employee' gets populated with dozens of Employee Names, until you enter an email address. 

The Work Email (populates a Text-Email field) if the same as the HR-Employees Work Email field puts the HR-Employee name in the Related Field. As soon as any email address is added the Related Employee field will only show one employee name, of the matching Employee email address. 

I would like to use an IF statement and from searching I see [Not IsNull) to check a field. It seems to me that is what I need to check for so that the new Extensions form Related Field stays blank until an email address is added. 

This is the formula in the 'Related Employee' field in the Extensions table.

ToText(GetFieldValues(GetRecords("{12.EX.'" & [Text-email] &"'}",[_DBID_HR_EMPLOYEES]),68))

The image shows the field in the form blank, as soon as any text is entered in the email address, otherwise it's filled with all the employee names. 



------------------------------
Bob T.
------------------------------
  • I tried solving this at school, but too busy. Kids these days, lol! Anyway, I was going to go on to the Zoom at 1pm, but it got cancelled. So finally I found the answer. 

    From my problem & solution file for Oct. 2023, the below is what I recorded.

    Works like a champ, so closing this annoying nuisance problem & now I understand a bit better how to use If-Then-Else better in QB. I understand how to and have written many modules in VB.Net (past years), PHP, C#, and a bit of Java.

    ToText(GetFieldValues(GetRecords("{12.EX.'" & [Text-email] &"'}",[_DBID_HR_EMPLOYEES]),68))


    Success with the below formula. The top formula worked but when the Work Emai address is blank, you get all the employees listed in the Related Employee Field.

    If(
    ToText([Work Email])<>"",ToText(GetFieldValues(GetRecords("{12.EX.'" & [Text-email] &"'}",[_DBID_HR_EMPLOYEES]),68)))



    ------------------------------
    Bob T.
    ------------------------------