Search code examples
ms-accessexpressionbuilder

Microsoft Access - query checkbox based on textbox


I have a field text field containing dates. I also have a checkbox named "Delivered"

If the text field contains a date, I would like the "Delivered" checkbox value to be "True" / ticked. If the text field isNull, the checkbox value must be "false" / not ticked

I have tried the following in the query expression builder of my checkbox:

IIf([DateField]="";False;True)

but I keep getting an error about the expression being built incorrectly?


Solution

  • You are trying to store a Calculation/dependent value in a table based on a field in the same table, this is not advisable and should not be carried forward. Calculations should be done when and where required, like display on Forms, Query to export or Reports to show. More info on Calculation field is available here : http://allenbrowne.com/casu-14.html

    If you really want to then you can create an UPDATE Query as,

    UPDATE 
        tableName 
    SET 
        DeliveredFieldName = IIF(Len(DateFieldName & '') = 0, False, True);