SQL Question

DaniBoy

Registered User.
Local time
Today, 10:31
Joined
Nov 18, 2001
Messages
174
Hello guys!!,
First of all, I love this new look, its great!!!!:D

I have a problem with a SQL code. I got the code from getting help here. Well here is the code.

SELECT Addresses.AddressID, WorkOrders.DateSent, WorkOrders.WorkorderID, WorkOrders.NewCartSize, WorkOrders.CartSize, Addresses.[Parcel#]
FROM Addresses INNER JOIN WorkOrders ON Addresses.AddressID=WorkOrders.AddressID
WHERE (((WorkOrders.DateSent)=(SELECT Max(WorkOrders1.DateSent) FROM WorkOrders AS WorkOrders1 WHERE Addresses.AddressID=WorkOrders1.AddressID) And (WorkOrders.DateSent) Between [Beginning Date] And [Ending Date]))
ORDER BY Addresses.AddressID, WorkOrders.WorkorderID, Addresses.[Parcel#];

this code is getting the max date from a table called WorkOrders the problem that I have is that the table name "WorkOrders" has been changed to "Work Orders". I have tried to change every thing that has "WorkOrders" to "Work Orders" but I get a syntax error when I try to save it.

Can someone tell me what am doing wrong? How can I fix this.

PS.WoW we can attach files now!!!! These is the best website for help!!!!

Thanks
DaniBoy
 
I think we need to know the context in which you get those errors. How are you trying to change the names?

I.e. click on the object in design view, change the name, save it?

Use VBA code to find references and change them?

Something else?
 
Because you changed the name of the Table from "WorkOrders" to "Work Orders" you will need to make the following changes to your SQL Strings when referencing the Table:

WorkOrders --> [Work Orders]

Notice the "[ ]", this lets Access know that this is a single table name.

I find that it is best practice to use the "[ ]" even when the name is a single word, especially when writing code/reports for someone else's db.
 

Users who are viewing this thread

Back
Top Bottom