Skip to main content
Question

Check presense of date/Time field? | IF in DateTime field gives syntax error

  • January 27, 2019
  • 0 replies
  • 40 views

Hi there QB-community,

I'm trying to build something around timekeeping.
In my design I have 2 date/time fields to get a start DateTime value from the user.
One field is created as a timestamp the other field is created by manual entry.
[StartTime_TimeStamp]
[StartTime_Manual]

Via a third formula date/time field [StartTimeFinal]  I like to use to most preferred start time in further presentation and reporting purposes.

So basically i look for an IF function to set the [StartTimeFinal]
in human logic something like:

IF [StartTime_Timestamp] exists than [StartTimeFinal] = [StartTime_TimeStamp] else
IF [StartTime_Manual] exists than [StartTimeFinal] = [StartTime_Manual]

But using the IF function in a date/time field gives a syntax error "expecting DateTime"

Who can give me some suggestions ?

Thanks Jan-Willem




This topic has been closed for replies.

Try this

IF( not isnull([StartTime_Timestamp]), [StartTime_TimeStamp], [StartTime_Manual])

  • Author
  • Registered
  • January 28, 2019
Ah thanks 'not isnull' ... everytime again you learn me something new :-)

about an hour off puzzling brought me to this solution that also seems to work
If(Day(ToDate([StartTime_TimeStamp]))<32,[StartTime_Manual],[StartTime_TimeStamp]).
I must admit yours is less coding and conversion thus possibly better/cleaner

We just finished dinner on my end.. so I continue my quest.. let's see what works best in the end.
I'll let you know.





  • Author
  • Registered
  • January 28, 2019
It works perfect with the 'not isnull' suggestion thanks