G
Guest
I am trying to use an if statement in the query criteria that checks to see if the DateDiff is equal to 0. The date comes from a form, where the user enters a start date and an end date. I assume if start date and end date are the same that DateDiff equals 0. Is this correct? I have tried a numer of different versions of my query below. Most work when the start date and end date are different, but if they are the same date cannot find any recorsd in the table.
Anyone know what I am doing wrong? I would appreciate any help you can give me.
IIf(DateDiff("d",[Forms].[frmGetDates].[txtStartDate],[Forms].[frmGetDates].[txtEndDate])=0,[Forms].[frmGetDates].[txtStartDate],([Incident_Tickets].[Create-date]) Between [Forms].[frmGetDates].[txtStartDate] And [Forms].[frmGetDates].[txtEndDate])
Anyone know what I am doing wrong? I would appreciate any help you can give me.
IIf(DateDiff("d",[Forms].[frmGetDates].[txtStartDate],[Forms].[frmGetDates].[txtEndDate])=0,[Forms].[frmGetDates].[txtStartDate],([Incident_Tickets].[Create-date]) Between [Forms].[frmGetDates].[txtStartDate] And [Forms].[frmGetDates].[txtEndDate])