Syntax error

Hi guys: Can any one please help me in that error?  Thanks

screenshot2.png
mustish1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Well, knowing what program you're using would be nice.

btw, the problem is that there are more libraries (see Tools/References) which have a Database or Recordset class defined. Thus

a) Use in VBA always the library name, thus DAO.Database or DAO.Recordset or DAO.TableDef..
b) Check your references whether you have added the appropriate library.

But I guess it's b).
0
FarWestCommented:
I think it is better that you just make select * from the table then use the recordset fields().name

something like

rs1.open tablename, con
dim myArralist as String()
dim ii as integer
for ii = 1 to rs1.fields.count
myArralist .add rs1.fields(ii).Name
Next

Open in new window

0
mustish1Author Commented:
got error
screenshot2.png
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mustish1Author Commented:
i change it to prior version but still getting this error.

screenshot2.png
0
aikimarkCommented:
It looks like you are running code in an Access2003 (or earlier) database and trying to open an Access2007 (or later) database, which you can not do.
0
mustish1Author Commented:
i just create table in access 2010 and publish it in earlier version.
0
aikimarkCommented:
Is this a new Access 2010 database installation?
Is this a new PC or upgraded Windows OS?
0
mustish1Author Commented:
I installed it couple of year's ago its a 2010 on windows 7
0
aikimarkCommented:
Is this the first time you've opened this database in that environment?
0
mustish1Author Commented:
I open it multiple times.
0
aikimarkCommented:
I open it multiple times.
Did it worked properly those times?
0
mustish1Author Commented:
yes

screenshot2.png
0
aikimarkCommented:
You are showing us a table.  Where would your code run in such a scenario?
0
mustish1Author Commented:
in vb6

Dim con As New Connection
'Without adding library of Microsoft ADO 2.0 Library
'The connection can not be come
Dim rs As New Recordset
Dim rs1 As New Recordset

Private Sub Form_Load()
Print GetSortedFieldNames("[table1]")
End Sub
Function GetSortedFieldNames(tablename As String) As Variant
With con
.Provider = "Microsoft.jet.OLEDB.3.51.provider"
.ConnectionString = App.Path & "\db1.mdb"
.Open
End With
rs1.Open "table1", con, adOpenKeyset, adLockOptimistic, adCmdTable

    Dim db As Database, td As TableDef, f As Field
    
    Set db = CurrentDb
    Set td = db.TableDefs(tablename)
    Set myArrayList = CreateObject("System.Collections.ArrayList")
    
    For Each f In td.Fields
        myArrayList.Add f.Name
    Next
    
    myArrayList.Sort
    GetSortedFieldNames = Join(myArrayList.ToArray, ",")

End Function

Open in new window

0
aikimarkCommented:
Check your references.  I suspect that you will see a selected library that doesn't exist on your PC.
0
mustish1Author Commented:
Can you please tell me which one is missing?

screenshot2.png
0
aikimarkCommented:
Have you migrated to a 64-bit version of Windows?  The 32-bit versions of DLLs are in a SYSWOW sub folder.  I think your references are probably pointing to the 64-bit system folder.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mustish1Author Commented:
screenshot2.png
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.