i got this!

Option Explicit
Public con As New ADODB.Connection
Public rsTally As New ADODB.Recordset

Public Sub Connect()
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Aianski\Desktop\Cliente ko\SGO_Tally.mdb;Persist Security Info=False"
rsTally.Open "select * from tbl_Tally ", con, 3, 2
End Sub

i think its right. but when i run it i get
"syntax error in FROM clause."

I CANT CONTINUE MY PROJECT. :(
HELP ME!!

Dani AI

Generated

The message "syntax error in FROM clause" almost always means the database engine cannot parse the object name in the SQL, not that ADODB itself is broken. Common root causes are: the table/query name does not exactly match what you think (hidden trailing spaces or unexpected characters), the name contains punctuation or starts with a digit, the name is a reserved word, or the object you're calling is actually a parameterized saved query rather than a plain table.

was right to flag name conflicts in the code space, but note the difference: renaming a VB variable avoids confusion in your app, whereas the SQL parser cares only about the object name inside the SQL string. ’s portability tip is useful for deployments, and his note about delimiting names is on point — identifier delimiting solves many Access naming issues when special characters are present.

Practical checklist to resolve this:

  • Open the database in Access and run the same SQL there. Access will often give a clearer error.
  • Verify the exact object name in the Navigation Pane (watch for leading/trailing spaces and identical names used for both a table and a query).
  • Dump the SQL string before execution (print it) to reveal invisible characters or accidental concatenation errors.
  • If the object is a saved query that requires parameters, convert it or supply parameters via a Command object instead of opening it directly.
  • If names contain spaces/special chars or collide with reserved words, use proper identifier delimiting in the SQL.

Extra notes: ensure the connection is opening the intended file format and path (format/provider mismatches can surface as odd SQL errors), and run a Compact & Repair if the file might be corrupted. These checks will narrow the cause quickly and point to whether the fix belongs in the SQL, the Access schema, or the calling code.

Recommended Answers

All 2 Replies

do you have a conflicting table or anything else named rsTally or Connect?

It sounds like rsTally or Connect is a reserved word.. presumably because there is a function with the same name (so there is confusion in working out whether you meant the function, or the call?)

The ideal solution is what you have done... change the rsTally or Connect name and see if that works.

Try the following -

con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Aianski\Desktop\Cliente ko\SGO_Tally.mdb;Persist Security Info=False"

'First change the long path to -
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\SGO_Tally.mdb;Persist Security Info=False" 'This will eliminate future install errors when installing your application on a users pc, GIVEN the fact that the database do exist in your application path!!!

rsTally.Open "select * from tbl_Tally ", con, 3, 2

'Change to -
rsTally.Open "select * from [tbl_Tally] ", con, 3, 2 'Using enclosed brackets
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.