Automation Error Unspecified Error Message
am 19.11.2007 17:53:23 von Ecohouse
I'm running a query and get the error in the subject line above. This
is the query:
strSQL = "SELECT XL_Import.Gate, XL_Import.Region, XL_Import.Section,
XL_Import.[Charter Fields], " & _
"XL_Import.[Data Value], XL_Import.[Matrix 1 Table],
XL_Import.[Matrix 1 Attribute] " & _
"FROM XL_Import " & _
"WHERE (XL_Import.Section = 'DF" & x & "') AND (XL_Import.
[Data Value]<>'0') AND " & _
"(XL_Import.[Matrix 1 Table]= 'ProductOption') AND (XL_Import.
[Matrix 1 Attribute] ='package direction');"
If I paste this into an accesss query it runs fine. Any ideas what is
going on? I'm using Access 2003.
Re: Automation Error Unspecified Error Message
am 20.11.2007 00:11:13 von Rich P
Greetings,
I simplified your query by removing parens and the preceding table name
for each field:
strSQL = _
"SELECT Gate, Region, Section, [Charter Fields], " & _
"[Data Value], [Matrix 1 Table], [Matrix 1 Attribute] " & _
"FROM XL_Import " & _
"WHERE Section Like 'DF*' AND [Data Value]<>'0' AND " & _
"[Matrix 1 Table]= 'ProductOption' AND [Matrix 1 Attribute] ='package
direction'"
I also combined your X variable with a Like and * --
WHERE Section Like 'DF*' AND...
What I would do if I were you, starters, is to remove the Where clause
and select like the top 1
SELECT Top 1 Gate, Region, Section, [Charter Fields], " & _
"[Data Value], [Matrix 1 Table], [Matrix 1 Attribute] " & _
"FROM XL_Import"
to make sure that the base query is correct.
If this runs, then the problem is in your Where clause (I am guessing
the X variable). If the base query doesn't work, then you probably
misnamed a field. If so, start out by querying only 1 field, or do a
Select * From XL_Import. If the base query does run, then try out your
Where clause with the Like 'DF*' And...
Rich
*** Sent via Developersdex http://www.developersdex.com ***