Share via

DateDiff error in table calculated field

Anonymous
2024-11-25T16:09:14+00:00

I'm getting the error "Invalid Sytax - You may have entered a comma without a preceding value or identifier"

Table Calculated field Expression - IIf(And([BR_Date_reported]<>"",[BR_Date_deleted]<>""),DateDiff("d",[BR_Date_reported],[BR_Date_deleted]),"")

I cannot find a way to make it work. any suggestions appreciated.

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

ScottGem 68,830 Reputation points Volunteer Moderator
2024-11-25T17:37:30+00:00

The Calculated Data type is somewhat limited in the expressions it can use. I wrote a blog on that.

Bottom line is I don't use the Calculated data type. If I want to do calculations, I do it in queries or controls on forms.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Duane Hookom 26,825 Reputation points Volunteer Moderator
2024-11-25T20:00:16+00:00

Sorry, I didn't realize this was a calculated field in a table design. Like Scott, I don't use them as I prefer to create the value in a query or control source.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2024-11-25T16:28:43+00:00

    getting response "The expression cannot be used in a calculated column"

    Was this answer helpful?

    0 comments No comments
  2. Duane Hookom 26,825 Reputation points Volunteer Moderator
    2024-11-25T16:23:20+00:00

    I believe you are using Excel syntax. Try:

    IIf(Not IsNull([BR_Date_reported]) and Not IsNull([BR_Date_deleted]),DateDiff("d",[BR_Date_reported],[BR_Date_deleted]),Null)

    Was this answer helpful?

    0 comments No comments