473,583 Members | 3,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need to check if field is empty

Hi ALl,

I have a code that checks if the documents in a hyperlink field are still
where they should be. I use fileexist().
First I want to filter out all the hyperlink fields that are empty.
I open a recordset and browse through all the fields to check for the word
file. I cannot filter out the empty fields.

I have tried: If Len(.Fields("Li nk") <> 0 then
and: If Not IsNull(.Fields( "Link")) then
and: If .Fields("link") .Value <> 0 then

but nothing works fine. Somehow when a hyperlink field has been filled and
emptied again something remains there, so it is not NULL.

Can anyone help me out?

Regards

Marco
Nov 13 '05 #1
5 24618
m.*********@che llo.nl (Krechting) wrote:
Somehow when a hyperlink field has been filled and
emptied again something remains there, so it is not NULL.

Can anyone help me out?


Have you tried

If .Fields("Link") <> "" then

?

The field may contain a zero-length string.

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #2

"Krechting" <m.*********@ch ello.nl> wrote in message
news:a7******** *************** ***@posting.goo gle.com...
Hi ALl,

I have a code that checks if the documents in a hyperlink field are still
where they should be. I use fileexist().
First I want to filter out all the hyperlink fields that are empty.
I open a recordset and browse through all the fields to check for the word
file. I cannot filter out the empty fields.

I have tried: If Len(.Fields("Li nk") <> 0 then
and: If Not IsNull(.Fields( "Link")) then
and: If .Fields("link") .Value <> 0 then

but nothing works fine. Somehow when a hyperlink field has been filled and
emptied again something remains there, so it is not NULL.

Can anyone help me out?

Regards

Marco

There are a number of possible values which would look blank on the screen.
A null value, a zero-length string and, harder to accidentally enter via a
form, one or more spaces. To test for any of these in one line, try:

If Len(Trim(Nz(.Fi elds("Link"), "")))=0

Firstly any null values are turned to zero-length strings, and then the
spaces are trimmed so any of the three above-mentioned values all become
zero-length strings and so you can check the length.

By the way, if the difference between null values and zero-length strings is
of no use to you in this application, you could change the design of the
table so this field cannot contain a zero-length string.

Nov 13 '05 #3
Tnx,

This is working almost perfectly.
There is only one minor issue, the code does not work on the first record.
It'll say the file was not found although the field is empty.

Marco

"Eric Schittlipz" <er**@schittlip z.com> wrote in message
news:cq******** **@titan.btinte rnet.com...

"Krechting" <m.*********@ch ello.nl> wrote in message
news:a7******** *************** ***@posting.goo gle.com...
Hi ALl,

I have a code that checks if the documents in a hyperlink field are still
where they should be. I use fileexist().
First I want to filter out all the hyperlink fields that are empty.
I open a recordset and browse through all the fields to check for the
word
file. I cannot filter out the empty fields.

I have tried: If Len(.Fields("Li nk") <> 0 then
and: If Not IsNull(.Fields( "Link")) then
and: If .Fields("link") .Value <> 0 then

but nothing works fine. Somehow when a hyperlink field has been filled
and
emptied again something remains there, so it is not NULL.

Can anyone help me out?

Regards

Marco

There are a number of possible values which would look blank on the
screen. A null value, a zero-length string and, harder to accidentally
enter via a form, one or more spaces. To test for any of these in one
line, try:

If Len(Trim(Nz(.Fi elds("Link"), "")))=0

Firstly any null values are turned to zero-length strings, and then the
spaces are trimmed so any of the three above-mentioned values all become
zero-length strings and so you can check the length.

By the way, if the difference between null values and zero-length strings
is of no use to you in this application, you could change the design of
the table so this field cannot contain a zero-length string.


Nov 13 '05 #4
I think we need to see more of your code in order to track that error down.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Marco Krechting" <ma************ @zonnet.nl> wrote in message
news:c0******** *************** ****@news1.zonn et.nl...
Tnx,

This is working almost perfectly.
There is only one minor issue, the code does not work on the first record.
It'll say the file was not found although the field is empty.

Marco

"Eric Schittlipz" <er**@schittlip z.com> wrote in message
news:cq******** **@titan.btinte rnet.com...

"Krechting" <m.*********@ch ello.nl> wrote in message
news:a7******** *************** ***@posting.goo gle.com...
Hi ALl,

I have a code that checks if the documents in a hyperlink field are still where they should be. I use fileexist().
First I want to filter out all the hyperlink fields that are empty.
I open a recordset and browse through all the fields to check for the
word
file. I cannot filter out the empty fields.

I have tried: If Len(.Fields("Li nk") <> 0 then
and: If Not IsNull(.Fields( "Link")) then
and: If .Fields("link") .Value <> 0 then

but nothing works fine. Somehow when a hyperlink field has been filled
and
emptied again something remains there, so it is not NULL.

Can anyone help me out?

Regards

Marco

There are a number of possible values which would look blank on the
screen. A null value, a zero-length string and, harder to accidentally
enter via a form, one or more spaces. To test for any of these in one
line, try:

If Len(Trim(Nz(.Fi elds("Link"), "")))=0

Firstly any null values are turned to zero-length strings, and then the
spaces are trimmed so any of the three above-mentioned values all become
zero-length strings and so you can check the length.

By the way, if the difference between null values and zero-length strings is of no use to you in this application, you could change the design of
the table so this field cannot contain a zero-length string.



Nov 13 '05 #5

"Marco Krechting" <ma************ @zonnet.nl> wrote in message
news:c0******** *************** ****@news1.zonn et.nl...
Tnx,

This is working almost perfectly.
There is only one minor issue, the code does not work on the first record.
It'll say the file was not found although the field is empty.

Marco


When it does that, what is the length reported by the expression
Len(Trim(Nz(.Fi elds("Link"), "")))
I expect it is not zero, but for some reason the field looks blank. Perhaps
you have vbCrLf as the first characters so that you have two lines: a blank
one and one under it which you can't see. Make sure it really is null by
running an update query. If you're still having trouble, post you code like
Doug suggests.

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5164
by: KathyB | last post by:
Hi, I'm trying to find a way to validate input text boxes where I don't know the names until the page is rendered. I've got 2 validate functions that fire with the onsubmit button of a "mini" form within the html document. When the Finish button is clicked, I need to check for any empty input boxes before loading the next aspx page...but it...
2
41267
by: Paul Telco | last post by:
Hello, I'm a new user designing a simple database to retrieve pre-prepared docunents for printing. I have five tables, a form to design the documents, a form to customise and retrieve the documents, a query to pull the data together from the tables and a report which formats the document with the custom data ready to print. It works...
30
35852
by: S. van Beek | last post by:
Dear reader A record set can be empty because the condition in the query delivers no records. Is there a VBA code to check the status of a record set, record set empty
1
5562
by: Oleg Ogurok | last post by:
Hi all, I want to use RegularExpressionValidator to enforce non-empty integer format in a TextBox. However, the validator doesn't give the error when the textbox is empty. For example, if ValidationExpression is \d+ or even \d{1,}, the validator still allows empty field. Must I use an additional RequiredFieldValidator? -Oleg.
4
3183
by: whisher | last post by:
Hi. I'm taking my first steps on regex I set up this simple function to check if a form field is empty or with only space. var onlySpaceRegexp = /^\s*$/; function isEmpty(val) { if (onlySpaceRegexp.test(val) || val == "") {
5
3516
by: Marjeta | last post by:
I'm trying to very that the user actually entered something in the form, and not just spaces. I guess the problem is in the first line of isBlank() function. I've tried the following: elem.value.trim(); elem.value=elem.value.trim(); elem.value=trim(elem.value); elem.value.replace(/^\s+|\s+$/g,"");and none works. It correctly gives me an...
3
2957
by: akshalika | last post by:
I want regular expression which check for empty. pls help me.
10
20975
by: klharding | last post by:
I am reading the contents of a text file into variables. All works well if the text file does not exist, or it does exist and contains 4 rows of data. But I need to account for rows being empty or null. How can I check this? string filename = @"C:\Program Files\Picture Capture\Settings.txt"; if (File.Exists(filename)) { ...
3
7918
by: accessbeginerry | last post by:
I have a form with subforms on it (subforms are designed on tabcontrol and each has separate page) After user enter information on form and tries to hit "Save" button i would like the access first to check if value in a subform field is not empty. It is tblTakeOrder form. When user fills information on form with order id, client name and...
0
7893
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7821
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7928
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8188
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6574
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5369
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3813
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1422
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.