Solved

Searching empty string in the database

Posted on 1998-08-04
2
199 Views
Last Modified: 2010-05-03
I am checking  all the database tables fields for empty string. I used
"do loop " statement go to each table and check  each field  FOR empty string  .It works but it seems so slow especially with large amount of data.
So is there any way of doing it? Like using any API FUNCTION???
0
Comment
Question by:ozlem
2 Comments
 
LVL 7

Expert Comment

by:tward
ID: 1467725
Posting some code may help to determine if/where there is a slow point.
0
 

Accepted Solution

by:
jaimereed earned 20 total points
ID: 1467726
Try creating a new recordset from the database using an SQL statement that only selects records with an empty string (note you can't use the * in criteria so you have to separately specify the field names). E.g.

set rs = theDb.OpenRecordSet("SELECT * FROM [your table] WHERE ( ( [Field1] = NULL)  OR ( [Field2]= NULL ) OR ... )"

You can then do whatever you want with the entire returned recordset. Note that this may not work if you have explicity told the database to use empty-strings rather than NULLs. If this is the case replace NULL with ''. MS Access/VB default to using NULLS (which is faster).
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question