passed parameter and datepart not equal? why?

C

Cheryl

I have this question formulated further back as part of another question,
however I thought perhaps its just best to start a different post. My
apologies if that was not correct...

I have passed a parameter from a form into a variable on a result page. The
parameter was derived from breaking apart a date field for the year
information to be used as part of a drop down list.

The variable displays the correct information, however, when I break apart
the date in the database that it is searching for it can't find the record.
As a test I write out the contents of both the variable and the datepart year
in the database and they both look the same.. Yet, it can't find it. Is it
perhaps that it thinks the date/year broken apart from the form is a text
field and the datepart/year being compared to in the sql database is an
integer?

dim recFound
dim PartYear

VarName = request("FullName")
VarYear = request("TimeSheetYear")
VarWeek = request("YearWeekNo")

PartYear=1900

strSQL4 = "SELECT DatePart(ww, DateWorked) as WeekNumberPartial,
DatePart(yyyy, DateWorked) as YearPartial,* from TimeSheets INNER JOIN
Employees ON TimeSheets.EmployeeID = Employees.EmployeeID ORDER BY
Employees.FullName, TimeSheets.DateWorked, TimeSheets.JobNumberID DESC,
TimeSheets.PartNumber, TimeSheets.Other"

<% do while not objRecordset4.EOF %>
<% if objRecordset4.Fields("FullName") = varName then %>
<% if objRecordset4("YearPartial") = VarYear then %>

I have can't figure out how to fix it if that is the case...

Thanks in advance for your assistance...
 
C

Cheryl

Never mind all.. just in case someone thought about answering... had to
explicitly make my variable an integer......
 

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

Top