Method or datamember not found

Becca
07-20-2003, 12:06 AM
Hi,

I'm having a problem with some code (I'm really new to doing anything with database - sorry!)
I'm making a program that will randomise results found in a database, and I'm displaying them in a listbox.
I have already declared the ADO connection, and Code is the name of the primary key I want to get information from.
It's just that when I go to randomise, I have a problem with the part of the code:

Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\WINDOWS\Desktop\Music.mdb;"
MyConn.Open
'Set MyRecSet = MyConn.Execute("SELECT Code FROM Music_Table")
Set MyRecSet = New ADODB.Recordset
MyRecSet.Open "SELECT Code FROM Music_Table", MyConn, adOpenKeyset, adLockOptimistic
IntCo = MyRecSet("Code")


Do
PKey(k) = MyRecSet.[Code]
MyRecSet.MoveNext
k = k + 1
Loop Until MyRecSet.EOF


There's a problem with the MyRecSet.[Data], and it says Method or Datamember not found. I don't understand what the problem is, since that's the data I want to retrieve. Do you have any idea what the problem is? It's ok if you can't help me, I just thought I'd ask...
thankyou!! :)

Becca

Optikal
07-20-2003, 12:08 AM
use MyRecSet("Code") instead of MyRecSet.[Code]

Becca
07-20-2003, 12:21 AM
Hi, thanks for the response

I've tried that, but I get an error message saying Expected: identifier or bracketed response

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum