Duplicate first record. 
Author Message
 Duplicate first record.

I am simply trying to read an Access 97 table as a
recordset. The program follows:

  Dim db As Database
  Dim rsPeriods As Recordset

  Set db = CurrentDb
  Set rsPeriods = db.OpenRecordset _
    ("tblPeriods", dbOpenSnapshot)

      rsPeriods.MoveFirst
      Do Until rsPeriods.EOF
        Debug.Print rsPeriods("gl_perod_id") & "..." & _
          rsPeriods("gl_perod_stdt") & "..." & _
          rsPeriods("gl_perod_enddt")
        rsPeriods.MoveNext
      Loop

What prints in the debug window is:

1...12/29/2002...01/25/2003 11:59:59 PM
1...12/29/2002...01/25/2003 11:59:59 PM
2...01/26/2003...02/22/2003 11:59:59 PM
3...02/23/2003...03/22/2003 11:59:59 PM
4...03/23/2003...04/19/2003 11:59:59 PM
5...04/20/2003...05/17/2003 11:59:59 PM
6...05/18/2003...06/14/2003 11:59:59 PM
7...06/15/2003...07/12/2003 11:59:59 PM
8...07/13/2003...08/09/2003 11:59:59 PM
9...08/10/2003...09/06/2003 11:59:59 PM
10...09/07/2003...10/04/2003 11:59:59 PM
11...10/05/2003...11/01/2003 11:59:59 PM
12...11/02/2003...11/29/2003 11:59:59 PM
13...11/30/2003...01/03/2004 11:59:59 PM

As you can see the first record is duplicated. There are
only 13 records in the table. Any ideas would be much
appreciated. Thanks.



Mon, 12 Dec 2005 03:20:04 GMT  
 Duplicate first record.

Quote:
>-----Original Message-----
>I am simply trying to read an Access 97 table as a
>recordset. The program follows:

>  Dim db As Database
>  Dim rsPeriods As Recordset

>  Set db = CurrentDb
>  Set rsPeriods = db.OpenRecordset _
>    ("tblPeriods", dbOpenSnapshot)

>      rsPeriods.MoveFirst
>      Do Until rsPeriods.EOF
>        Debug.Print rsPeriods("gl_perod_id") & "..." & _
>          rsPeriods("gl_perod_stdt") & "..." & _
>          rsPeriods("gl_perod_enddt")
>        rsPeriods.MoveNext
>      Loop

>What prints in the debug window is:

>1...12/29/2002...01/25/2003 11:59:59 PM
>1...12/29/2002...01/25/2003 11:59:59 PM
>2...01/26/2003...02/22/2003 11:59:59 PM
>3...02/23/2003...03/22/2003 11:59:59 PM
>4...03/23/2003...04/19/2003 11:59:59 PM
>5...04/20/2003...05/17/2003 11:59:59 PM
>6...05/18/2003...06/14/2003 11:59:59 PM
>7...06/15/2003...07/12/2003 11:59:59 PM
>8...07/13/2003...08/09/2003 11:59:59 PM
>9...08/10/2003...09/06/2003 11:59:59 PM
>10...09/07/2003...10/04/2003 11:59:59 PM
>11...10/05/2003...11/01/2003 11:59:59 PM
>12...11/02/2003...11/29/2003 11:59:59 PM
>13...11/30/2003...01/03/2004 11:59:59 PM

>As you can see the first record is duplicated. There are
>only 13 records in the table. Any ideas would be much
>appreciated. Thanks.
>.
>Discovered my own problem.

I was using an SQL statement to create the table I was
pulling data from. The "SET" statement MUST come after the
SQL statement even though the same number of records are
being pulled in each and every time.


Mon, 12 Dec 2005 23:34:56 GMT  
 Duplicate first record.
Copying and pasting your data and your code, and executing in my copy of
Access 97, I can't reproduce your problem.

Have you applied all the Service Releases/Service Packs to both Access 97
and the Jet 3.51 database engine? My Access 97 indicates SR2; properties on
my copy of msjet35.dll indicates it is version 3.51.2026.0.

Another interesting thing... I defined the "perod_stdt" and "perod_enddt"
fields as date/time and they did not print leading zeros, as your post
indicated. I don't think it could cause this problem, but perhaps your
fields are defined as text or you have entered a format in the table
definition.

One final FYI, I did not define a primary key on the tblPeriods that I
created.

Please follow up, if you have any additional information, here in the
newsgroup, not by e-mail.

  Larry Linson
  Microsoft Access MVP


Quote:
> I am simply trying to read an Access 97 table as a
> recordset. The program follows:

>   Dim db As Database
>   Dim rsPeriods As Recordset

>   Set db = CurrentDb
>   Set rsPeriods = db.OpenRecordset _
>     ("tblPeriods", dbOpenSnapshot)

>       rsPeriods.MoveFirst
>       Do Until rsPeriods.EOF
>         Debug.Print rsPeriods("gl_perod_id") & "..." & _
>           rsPeriods("gl_perod_stdt") & "..." & _
>           rsPeriods("gl_perod_enddt")
>         rsPeriods.MoveNext
>       Loop

> What prints in the debug window is:

> 1...12/29/2002...01/25/2003 11:59:59 PM
> 1...12/29/2002...01/25/2003 11:59:59 PM
> 2...01/26/2003...02/22/2003 11:59:59 PM
> 3...02/23/2003...03/22/2003 11:59:59 PM
> 4...03/23/2003...04/19/2003 11:59:59 PM
> 5...04/20/2003...05/17/2003 11:59:59 PM
> 6...05/18/2003...06/14/2003 11:59:59 PM
> 7...06/15/2003...07/12/2003 11:59:59 PM
> 8...07/13/2003...08/09/2003 11:59:59 PM
> 9...08/10/2003...09/06/2003 11:59:59 PM
> 10...09/07/2003...10/04/2003 11:59:59 PM
> 11...10/05/2003...11/01/2003 11:59:59 PM
> 12...11/02/2003...11/29/2003 11:59:59 PM
> 13...11/30/2003...01/03/2004 11:59:59 PM

> As you can see the first record is duplicated. There are
> only 13 records in the table. Any ideas would be much
> appreciated. Thanks.



Tue, 13 Dec 2005 00:48:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. I am getting duplicate records, I mean everything is duplicate even Access record number

2. Duplicate record error using OnNotInList event

3. Duplicate Records

4. dUPLICATE RECORDS

5. duplicate records

6. copy/duplicate record problem

7. before saving a record, check duplicate entries

8. do not print duplicate record details in grouping

9. Searching for Text to prevent duplicate client records

10. Duplicating labels for certain records in a report

11. Create a duplicate of current record

12. Duplicate a record with a VBA sub

 

 
Powered by phpBB® Forum Software