Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a query in Excel 2003 to run a query to Access database. If I manually
run the query it works, but my macro to run it bombs out with Compile Error- Syntax Error. It is a complicated query linking several tables, but why would it work to run manual and not work in VBA? Here it is in case anyone wants to slug thur it- more after, but it stops where the double break appears below With Selection.QueryTable .Connection = Array(Array( _ "ODBC;DSN=CustomDietResearch;Description=Custo m Diet Research Database;UID=CustomDietResearch;APP=Microsoft Office 2003;WSID=378PC11;" _ ), Array("DATABASE=Teklad_Custom_Diet_Research;Truste d_Connection=Yes")) .CommandText = Array( _ "SELECT Diet.TDNumber, Diet.DietName, Diet.UserID, CustomerInformation.CompanyName, CustomerInformation.ContactName, CustomerInformation.PhoneNumber, CustomerInformation.EmailAddress, DietIndexingInfor" _ , _ "mation.Species, DietIndexingInformation.ModificationDiet, DietIndexingInformation.KeyFeature2, DietIndexingInformation.KeyFeature3, DietIndexingInformation.KeyFeature4, DietCustomerServiceInfo.Special" _ , _ "Packaging, DietCustomerServiceInfo.FormDescription, DietCustomerServiceInfo.Irradiated, DietCustomerServiceInfo.CustomerInfo"&chr(13)&""&c hr(10)&"FROM Teklad_Custom_Diet_Research.CustomDietResearch.Cus tomerInformation Cu" _ , _ "stomerInformation, Teklad_Custom_Diet_Research.CustomDietResearch.Die t Diet, Teklad_Custom_Diet_Research.CustomDietResearch.Die tCustomerServiceInfo DietCustomerServiceInfo, Teklad_Custom_Diet_Research" _ , _ ".CustomDietResearch.DietIndexingInformation DietIndexingInformation"&chr(13)&""&chr(10)&"WHERE CustomerInformation.TDNumber = Diet.TDNumber AND Diet.TDNumber = DietCustomerServiceInfo.TDNumber AND DietCustomerServiceInfo" _ ,) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 MS Query prompt yields Syntax error | Excel Discussion (Misc queries) | |||
MS Query import from Excel - Syntax Error | Excel Discussion (Misc queries) | |||
Syntax Error in Excel Query for DATE field | Excel Discussion (Misc queries) | |||
Syntax Error - Using Microsoft Query and ODBC link to a table | Excel Discussion (Misc queries) | |||
Syntax error (missing operator) in query expression '6 Wescott Rd# | Excel Discussion (Misc queries) |