trying to work with table data

G

Gator

I have a table named "A/P Details". I am trying to access it using some of
the following code but it isn't reaching it. Can someone look at the code
for me to see if I am using correct syntax for the table name "A/P Details"
in the following two examples?

Example 1
ADOrs.Open "A/P_Details", mycon, adOpenKeyset, adLockOptimistic

Example 2
lstboxFundTotals.RowSource = "SELECT LEFT(Account,2),
FORMAT(SUM(Amount),'currency') FROM A/P_Details WHERE ([Date]=[Text16]) GROUP
BY Left(Account,2) ORDER BY Left(Account,2) ASC;"
 
M

Maurice

You know that this name would give troubles when creating it didn't you or
were you pushed into using this name?

Anyway try placing the tablename between brackets like: [A/P_Details]

My guess would be that in the sql statement it is trying to divide something
as it is written now.

Let us know if that did the trick
 
J

JoshD

As developers and programmers I suggest that you adhere to naming conventions.
Since some characters have different meanings, especially in sql, DO NOT use
any none alpha-numeric characters in names. The name A/P Details should be
APDetails.
If you do use none alpha-numeric characters, even the innocent space
(chr(32)), you must surround the name with brackets [ aaa aaa ]. Some times
quotes (chr(34)) are allowed too " aaa aaa "
 

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