0

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?

user2502658
  • 115
  • 3
  • 16
  • Are you trying to do this on a Form, Query, table? – PaulFrancis Aug 18 '14 at 10:19
  • @PaulFrancis Im trying to do this in the expression builder on a Query – user2502658 Aug 18 '14 at 12:38
  • Is the field in the Table a Checkbox? What I actually mean is, are you trying to create an UPDATE Query or a simple SELECT? If it is a simple select, the True will be -1 and False be 0. It cannot format as Checkbox, unless you create a Report or Form. – PaulFrancis Aug 18 '14 at 12:40
  • Yes the field is a checkbox. it needs to be "checked" in there is a date in the textfield (Datefield), and not checked if no date appearsin the textfield (Datefield). it is SELECT – user2502658 Aug 18 '14 at 12:42

1 Answers1

0

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);
PaulFrancis
  • 5,748
  • 1
  • 19
  • 36