OpenForm action canceled

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I do not know why this is happening....the code below works if there is no
dates selected in either txtStartDate or txtEndDate, but if there are dates,
then I get an error the the OpenForm action was canceled.

How would I debug this? Any ideas?

Thanks in advance....


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmDispositionHistory"

If IsNull([txtStartDate]) And IsNull([txtEndDate]) Then
stLinkCriteria = "[VehicleNumber]=" & Me![VehicleNumber]

Else
stLinkCriteria = "VehicleNumber='" & Me!VehicleNumber & "' And " &
"DispositionDate >= #" & Format$(Me!txtStartDate, "dd/mm/yyyy") & "# OR " &
"DispositionDate <= # " & Format$(Me!txtEndDate, "dd/mm/yyyy") & "#"

End If

DoCmd.OpenForm stDocName, , , stLinkCriteria
 
Sorry, should have posted the stLinkCriteria value....

it is:

stLinkCriteria = "VehicleNumber='4091' AND DispositionDate >= #01/12/2004# OR_
DispositionDate <=#04/01/2005#"

I am assuming the last part after the OR as I cannot seem to display the
full value when I hover the mouse over stLinkCriteria.

Cheers
 
Back
Top