The problem may have something to do with your references. Have you included Microsoft DAO Object Library in your list of references? In VBA window go to References and check Microsoft DAO [version number] Object Library. See if this solves your problem.
Regards Liveson ----- Original Message ----- From: bryan.leggo To: [email protected] Sent: Monday, 03 December, 2007 2:51 AM Subject: [ms_access] Re: How do I mone One record at a time through a table? Okay, so I partly figured out the answer to my own question, which is to use recordsets. Below is the code I found that showed me what to do but THIS doesn't work either for a couple of reasons. First, "Database" is not recognized as a keyword or legitimate type. Second, the db.OpenRecordset doesn't work either because of a type mismatch. And when I change it to db.Openrecordset("GoodTablename", dbOpenTable) and I check the debugger to see what the value of dbOpenTable is and it's null although I suspect this is supposed to be a legit VB global constant. So what's going on? I am using Acess 2000 and I guess the matching VBA. Does that have something to do with it? Or should I be doing something to include an external library or something? Dim db As Database Dim rs As Recordset sTableName = "HTMLPages" Set db = CurrentDb() Set rs = db.OpenRecordset(sTableName) Do While Not rs.EOF Debug.Print (rs![PageName]) rs.MoveNext Loop rs.Close db.Close --- In [email protected], "bryan.leggo" <[EMAIL PROTECTED]> wrote: > > Sorry for the simplistic questions again, but how do I move through a > table one record at a a time so that can check the contents of fields > as as I go. Here's pseudo-code for what I want: > > For I = 1 to NumberOfRecordsinaTable > Go to Record I > X = RecordI.Fieldname 1 > Y = RecordI.Fieldname 4 > Z = RecordI.Fieldname 8 > NEXT I > [Non-text portions of this message have been removed]
