Solved Nz(string,ifnull(my string))

Reshmi mohankumar

Registered User.
Local time
Today, 22:07
Joined
Dec 5, 2017
Messages
101
Me.simg.Picture = Nz(CurrentProject.Path & StudentPhoto, CurrentProject.Path & "\StudentImages\INDEX.JPG")
Me.fimg.Picture = Nz(CurrentProject.Path & FatherPhoto, CurrentProject.Path & "\StudentImages\INDEX.JPG")

But this code is under forms onCurrent event
if there is a no string i got error like '2220' can't open the file "F:\SmartSchool".
 
Hi. Where did "F:\SmartSchool" come from?
 
You might need to use something along the lines of Dir() or a Filesystemobject rather than NZ. NZ is to test database record columns for Null.
 
Hi. Where did "F:\SmartSchool" come from?
i hope i used currentproject.path used in value if null place so.
my db had only path string if which are having paths they can visible , but which are not having path i got error like above.
 
NZ has 2 arguments:

1. The thing you are testing (CurrentProject.Path & StudentPhoto)
2. What to use when that first thing is NULL ( CurrentProject.Path & "\StudentImages\INDEX.JPG")

For #1 to be truly NULL both parts must be NULL. If CurrentProject.Path has a value but StudentPhot doesn't, it evaluates to true and the second part isn't used. Most likely Part 1 should only test StudentPhoto and CurrentProject.Path should not be anywhere in the NZ:

=CurrentProject.Path & NZ(StudentPhoto, "\StudentImages\INDEX.JPG" )
 
You might need to use something along the lines of Dir() or a Filesystemobject rather than NZ. NZ is to test database record columns for Null.
I dont know how to use them....Is simple inline code??
 
NZ has 2 arguments:

1. The thing you are testing (CurrentProject.Path & StudentPhoto)
2. What to use when that first thing is NULL ( CurrentProject.Path & "\StudentImages\INDEX.JPG")

For #1 to be truly NULL both parts must be NULL. If CurrentProject.Path has a value but StudentPhot doesn't, it evaluates to true and the second part isn't used. Most likely Part 1 should only test StudentPhoto and CurrentProject.Path should not be anywhere in the NZ:

=CurrentProject.Path & NZ(StudentPhoto, "\StudentImages\INDEX.JPG" )

it worked...And i learnt good point
i need to have strong skills ....You took me cafe to refresh...Thank you sir
 
I dont know how to use them....Is simple inline code??
Well, your original post didn't actually explain what your goal is. I had to interpret it from looking at your code, which makes it look like you are testing for the existence of files by using NZ--which won't work.
If plog is right, and you're actually just wanting to run a logic like this:
If a certain Form control's value is Null, then display CurrentProject.Path & "\StudentImages\INDEX.JPG
...Then I would recommend his suggestion.

If, in contrast, you actually want to check for the existence of a windows file (does it exist or not?), then you want to look into using Dir() or FSO
 
Well, your original post didn't actually explain what your goal is. I had to interpret it from looking at your code, which makes it look like you are testing for the existence of files by using NZ--which won't work.
If plog is right, and you're actually just wanting to run a logic like this:
If a certain Form control's value is Null, then display CurrentProject.Path & "\StudentImages\INDEX.JPG
...Then I would recommend his suggestion.

If, in contrast, you actually want to check for the existence of a windows file (does it exist or not?), then you want to look into using Dir() or FSO
finally im good. thank you bro
 

Users who are viewing this thread

Back
Top Bottom