Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2005

Tip: Looking for answers? Try searching our database.

Delete a group of records in VB won't work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim Crowley - 13 May 2005 16:29 GMT
I have a waste to energy program I'm converting from Foxpro 2.5 to Access
2002. The history data file has several hundred thousand records, so I am
writing the data initially to a temp file and when completed to the history
file using a command button (Save/Print). Writing the record to the history
file works ok but, when I try to delete the record in the temp file the
record isn't deleted, doesn't even ask to confirm delete. In my test in the
immediate window in VB it worked on the first try but wouldn't work again
after I attempted to run the code from my app.

The code is:

CurrentDb.Execute "DELETE * from tbl_msw_temp where isnull(in_process)",
dbFailOnError

[in_process] field is blank when the record is completed

If I delete just the current record after save function using:

RunCommand acCmdDeleteRecord

it works.

Unfortunately I have a couple of scenarios when the routine must delete
more than the current record.

I've tried several different in_process syntax's (ie.)
 in_process=""
 in_process=" "
 in_process = null
Etc.

To no avail.

Any suggestions?

Thanks
TIM
Alex Dybenko - 13 May 2005 16:56 GMT
Try:

where in_process is null

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

>I have a waste to energy program I'm converting from Foxpro 2.5 to Access
> 2002. The history data file has several hundred thousand records, so I am
[quoted text clipped - 36 lines]
> Thanks
> TIM
Tim Crowley - 13 May 2005 18:46 GMT
Hi Alex

I tried the change 'in_process is null' but to no avail

do you think it has anything to do with my access setup since it did work
once in the immediate window before deciding to never work again?

Tim
Alex Dybenko - 13 May 2005 20:19 GMT
Hi Tim,
so what is in in_process field actually? null or something else?
if null - then
CurrentDb.Execute "DELETE * from tbl_msw_temp where in_process is
null",dbFailOnError
should work

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> Hi Alex
>
[quoted text clipped - 4 lines]
>
> Tim
Tim Crowley - 13 May 2005 21:16 GMT
Hi Alex, me again

The syntax of my code is exactly as you had previously suggested.

CurrentDb.Execute "DELETE * from tbl_msw_temp where in_process is null",
dbFailOnError

The in_process field just has a text "x" inserted while I'm processing the
transaction. When the truck weighs out on the outgoing scale I change the
in_process field to blank (ie. " ") to mark for deletion. Pretty simple
delete coding I would think but unfortunately this is one of those day's
when my computer hates me.

TMC
Alex Dybenko - 14 May 2005 06:21 GMT
Hi Tim,
if you update it to " " - then you have also to filter by:
in_process = " "
so check how you update field and make corresponding filter

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> Hi Alex, me again
>
[quoted text clipped - 10 lines]
>
> TMC
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.