strSql

  • Thread starter Thread starter Armin
  • Start date Start date
A

Armin

What am I doing wrong here?I think it's somthing with
FORMAT.

strSQL = " SELECT
Workorders.WorkorderID,Workorders.CustomerID,
Workorders.DateReceived,workorders.ProblemDescription " & _
" FROM Workorders " & _
" WHERE ((Format([DateReceived],"yyyy")) = Year
(Now())) AND ((Workorders.CustomerID)=" & Me!
Customer.Column(0)))

Thanks in advance

armin
 
Armin said:
What am I doing wrong here?I think it's somthing with
FORMAT.

strSQL = " SELECT
Workorders.WorkorderID,Workorders.CustomerID,
Workorders.DateReceived,workorders.ProblemDescription " & _
" FROM Workorders " & _
" WHERE ((Format([DateReceived],"yyyy")) = Year
(Now())) AND ((Workorders.CustomerID)=" & Me!
Customer.Column(0)))

Why format the date? Why not just:

strSQL = _
"SELECT Workorders.WorkorderID,Workorders.CustomerID, " & _
"Workorders.DateReceived,workorders.ProblemDescription " & _
"FROM Workorders " & _
"WHERE Year([DateReceived) = Year(Date()) " & _
"AND Workorders.CustomerID=" & Me!Customer.Column(0)

? And is Customer.Column(0) the bound column of the combo box? If so,
you could simplify that last line to

"AND Workorders.CustomerID=" & Me!Customer
 
Thank you very much.It worked great.
Armin
-----Original Message-----
What am I doing wrong here?I think it's somthing with
FORMAT.

strSQL = " SELECT
Workorders.WorkorderID,Workorders.CustomerID,
Workorders.DateReceived,workorders.ProblemDescription " & _
" FROM Workorders " & _
" WHERE ((Format([DateReceived],"yyyy")) = Year
(Now())) AND ((Workorders.CustomerID)=" & Me!
Customer.Column(0)))

Why format the date? Why not just:

strSQL = _
"SELECT
Workorders.WorkorderID,Workorders.CustomerID, " & _
"Workorders.DateReceived,workorders.ProblemDes cription " & _
"FROM Workorders " & _
"WHERE Year([DateReceived) = Year(Date()) " & _
"AND Workorders.CustomerID=" & Me! Customer.Column(0)

? And is Customer.Column(0) the bound column of the combo box? If so,
you could simplify that last line to

"AND Workorders.CustomerID=" & Me!Customer

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Back
Top