strSql

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
 
D

Dirk Goldgar

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
 
G

Guest

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)


.
 

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