Accès à "Invalid SQL Statement"

Solved
Lazarey Posted messages 3255 Registration date   Status Member Last intervention   -  
yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   -
Hello everyone !!!!!!

I have a big problem with Access XP.

Here is my code:
Dim maconnexion As New Connection Dim rs1 As New Recordset Set maconnexion = CurrentProject.Connection rs1.LockType = adLockOptimistic rs1.CursorType = adOpenKeyset rs1.ActiveConnection = maconnexion rs1.Source = "Contacts A" rs1.Open


It gets stuck on the rs1.open and tells me that the "SQL statement is not valid," even though it's not a SQL query at all, but VBA code.
I think it's a problem with an option that needs to be checked in the preferences, because from what I remember, this piece of code works fine on Access 2000.

Thanks to anyone who will help me !!!
Configuration: Windows XP Firefox 2.0.0.14

3 answers

  1. yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   Ambassadeur 1 588
     
    What is "Contacts A"? If it's the name of a table or a query, I suggest trying "[Contacts A]".
    1
  2. Lazarey Posted messages 3255 Registration date   Status Member Last intervention   745
     
    Hi,

    It actually worked.
    I suppose it's because of the space in my table name that there was this issue, as it works fine without a space.

    Thank you very much.
    0
  3. yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   Ambassadeur 1 588
     
    Indeed, it's because of the space.
    0