![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello I'm new with Access and I have this problem. I created a database with a table that load his data from a txt file and all works good I have 76 records and it is well fetched in my database and when I display it all is good. Now in my macro... I added a SQL code that delete all the records in the table before loading the new data. There is 76 records but it tell me that it want to delete 152 records. But I displayed the table data before and a saw only my 76 records. Then I created a VB sub that count my records in my table and it said 152 !! This his the double than what I see in my table and in my txt file !? So please can you tell me what is the problem ? Thank you very much Jiador |
#3
| |||
| |||
|
|
I suspect the table's index was corrupted when running the SQL code from the macro. I would run Compact and Repair Database from (menu bar) Tools to do an automated repair. Rather than running simple SQL code from a macro, I'd suggest building a small Delete Query to delete the records in the Query Design window. Save it as a query and have the Macro run the query. The reason: I've seen cases where perfectly standard SQL code would cause problems in Access if the Access query design window was not used. This was when the straight SQL code was fed directly to the Access database, not via the query window. By designing the query in the query design window, you let Access "tweak" the SQL statements to be optimized for Access. I know that this cure should not be needed and would be expected not to help, but it did work in my case (when linking to Access file via an asp.net web page). Bruce Pick "Jiador" <laverf (AT) hotmail (DOT) com> wrote in message news:b2c1fef.0401161314.3de45b4b (AT) posting (DOT) google.com... Hello I'm new with Access and I have this problem. I created a database with a table that load his data from a txt file and all works good I have 76 records and it is well fetched in my database and when I display it all is good. Now in my macro... I added a SQL code that delete all the records in the table before loading the new data. There is 76 records but it tell me that it want to delete 152 records. But I displayed the table data before and a saw only my 76 records. Then I created a VB sub that count my records in my table and it said 152 !! This his the double than what I see in my table and in my txt file !? So please can you tell me what is the problem ? Thank you very much Jiador |
#4
| |||
| |||
|
|
I suspect the table's index was corrupted when running the SQL code from the macro. I would run Compact and Repair Database from (menu bar) Tools to do an automated repair. Rather than running simple SQL code from a macro, I'd suggest building a small Delete Query to delete the records in the Query Design window. Save it as a query and have the Macro run the query. The reason: I've seen cases where perfectly standard SQL code would cause problems in Access if the Access query design window was not used. This was when the straight SQL code was fed directly to the Access database, not via the query window. By designing the query in the query design window, you let Access "tweak" the SQL statements to be optimized for Access. I know that this cure should not be needed and would be expected not to help, but it did work in my case (when linking to Access file via an asp.net web page). Bruce Pick "Jiador" <laverf (AT) hotmail (DOT) com> wrote in message news:b2c1fef.0401161314.3de45b4b (AT) posting (DOT) google.com... Hello I'm new with Access and I have this problem. I created a database with a table that load his data from a txt file and all works good I have 76 records and it is well fetched in my database and when I display it all is good. Now in my macro... I added a SQL code that delete all the records in the table before loading the new data. There is 76 records but it tell me that it want to delete 152 records. But I displayed the table data before and a saw only my 76 records. Then I created a VB sub that count my records in my table and it said 152 !! This his the double than what I see in my table and in my txt file !? So please can you tell me what is the problem ? Thank you very much Jiador |
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |