opening forms

  • Thread starter Thread starter maxpower
  • Start date Start date
M

maxpower

Guest
I have a drop down with a list of years (2002, 2003 etc) that the user must select from. when they do so and click the GO button a new form will be displayed. I need to use this year to compare against a field in the table that the new form is using. However the field is in a dd-mm-yyyy format that can not be changed.
Is there any way i can do a like search on the value of the drop down against the value in the table to only give the records with a particular year? what i have at the moment is below but obviously this wouldnt work because it is saying, is dd-mm-yyyy like yyyy. How can i turn this like search around so its yyyy like dd-mm-yyyy?

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Master NCRs"

stLinkCriteria = "[OpenDate] like " & Me![NCRYear]
DoCmd.OpenForm stDocName, , , stLinkCriteria

thanks
 
Try changing your stLinkCriteria to
stLinkCriteria = "Year([OpenDate]) =" & Me![NCRYear]
 

Users who are viewing this thread

Back
Top Bottom