Docmd.openform with Date Criteria problem

Taff

Registered User.
Local time
Today, 11:03
Joined
Feb 3, 2004
Messages
158
Hi all,

Have a problem trying to open a form with certain dates.

I have the following information:-

tblReviews
Learn_ID -Text
Provi_ID - Text
Lprog_ID - Text
PlannedDate - Date/Time (Short Date Format)
ReviewType - Text

FrmReviewList
txtLearn_ID
txtProvi_ID
txtLProg_ID
txtPlanned
txtType

The above fields are unbound text boxes which retrieve the information from a listbox listReviews.

I have a command button which when I click opens frmEditReview using the following code:

Code:
Dim stDocName As String
Dim stLinkCriteria As String

    stDocName = "FrmEditReview"
    stLinkCriteria = "[Learn_id] = '" & Me![txtLearn_id] & "'" & " " & " and [provi_id] = '" & Me![txtProvi_id] & "'" & " " & " and [lprog_id] = '" & Me![txtLprog_id] & "'" & " " & " and [ReviewType] = '" & Me![txtType] & "'" & " " & " And [PlannedDate]= #" & CDate(Me![txtPlanned]) & "#"
    
    DoCmd.OpenForm stDocName, , , stLinkCriteria

If I try to open a record which includes a date such as 15/03/2005 then their is no problem, but if I try to open a record with something like 01/02/2005 then it will not open and opens a blank form. It only happens with dates where the dd part (Format dd/mm/yyyy) is less than or equal to 12.

Does anyone have any ideas?

Thanks in advance for any help.

Taff.
 

Users who are viewing this thread

Back
Top Bottom