OpenForm action canceled

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top