472,352 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

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("Link") <> 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 24332
m.*********@chello.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.*********@chello.nl> wrote in message
news:a7**************************@posting.google.c om...
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("Link") <> 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(.Fields("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**@schittlipz.com> wrote in message
news:cq**********@titan.btinternet.com...

"Krechting" <m.*********@chello.nl> wrote in message
news:a7**************************@posting.google.c om...
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("Link") <> 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(.Fields("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.zonnet.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**@schittlipz.com> wrote in message
news:cq**********@titan.btinternet.com...

"Krechting" <m.*********@chello.nl> wrote in message
news:a7**************************@posting.google.c om...
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("Link") <> 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(.Fields("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.zonnet.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(.Fields("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
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...
2
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...
30
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...
1
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...
4
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 =...
5
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...
3
by: akshalika | last post by:
I want regular expression which check for empty. pls help me.
10
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...
3
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.