473,765 Members | 2,070 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 24637
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
5177
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 could be no boxes or five boxes, etc.? I've included my html output...if you have any ideas,...
2
41375
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 very well unless:
30
35891
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
5588
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
3190
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
3525
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 error message if I leave the field completely blank.But if there's anything in the field, it does not...
3
2966
by: akshalika | last post by:
I want regular expression which check for empty. pls help me.
10
21095
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)) { StreamReader reader = new StreamReader(filename); string strAllFile =...
3
7930
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 required date and try to save it - access needs to check SubForm "Order details" if orders price is...
0
9568
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6649
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.