Delete Query Based on Null Records

Hey Lucy

Registered User.
Local time
Today, 13:30
Joined
Jan 20, 2012
Messages
124
This is driving me nuts!:banghead:

Records are exported from Excel to Access. Excel contains formulas for up to 200 records. (This is updated daily with data so no way of knowing each day how many rows with formulas are needed). I have two worksheets - GAMLS, where the original data resides, and Converted, where I have to do some clean up work on the original data. So all the records in the Converted worksheet are linked to the original data on the GAMLS worksheet. Formulas have been written with sort of a prelude that basically says that is the row is blank on the GMLS sheet, then show them as blank on the Converted sheet. Now, the rows on the Converted sheet are not really blank -- they contain formulas, but show blanks where there are no matching records. No problems with all this.

However, when I import the worksheet range into Access, it, of course, imports all 200 records, when, for example, today there are only 46 actual records, and the rest is just formulas.

So, I am trying to get a Delete Query to delete the records from within the Access table (TBL-GAMLS) that have blank rows. (In this case, there are 46 actual records and 154 "null" records.

I did this exact same thing with a separate spreadsheet and have no problems with it importing and doing the delete query.

I need to base this on the address field, so I'm saying that if the record doesn't show any address, delete it. But, if I use Is Null for the criteria for the Address field, (even if I change it to a Select query just to see), it basically does not find any null records.

Although I did this before using a separate spreadsheet (all this is in one database), the other one works, this one doesn't and I'm pulling my hair out.

If it would be easier to solve by actually seeing the spreadsheet and the database, I would be happy to share through DropBox with anyone who may be able to help me. This is crucial to the database. :(

Thanks to anyone who can help!!!
 
Have you tired testing for a ZLS (Zero Length String)?

Also rather than importing your Excel/CSV file directly into your working tables you might be better off importing it into a temporary table where you can "massage" the data before appending it to your working tables.

The sample here demonstrates the sort of thing I'm talking about.
 
Thanks, yes. I have been working on this database for the last 15 hours. I'm getting bumfuzzled and that completely slipped my mind!!! Such an easy solution! Sometimes I try too hard to complicate things. Thanks for your help!!!:o :)
 
find a column in the access table that contains some indicator that the record can be deleted - eg non -numeric, or blank etc

then design a query to select those rows - and make it a delete query

then simply currentdb.execute "mydeletequery"
 

Users who are viewing this thread

Back
Top Bottom