If IsNull(x) then Skip macro

shutzy

Registered User.
Local time
Today, 20:24
Joined
Sep 14, 2011
Messages
775
is it possible to say if box a IsNull() then move to the next step in the macro.

ive tried IsNotNull() as i have used this in queries before but it dosnt seem to work in macros

thanks
 
Provided your text box is bound then you can use:
If not IsNull(X) then
Other code here
End If

If it is unbound you will need to check the "text" property of the text box.
 
why, does the property of the txt box matter. it is bound now as in it wasnt at first. so as i am trying to use a macro is there as If Not. i have solved this but i wanted to know an easier way or just another way. the way i have used that works for this application is

If [txtbox]<>"" Then(basically does it have a value(curtacy of google))

i do feel that i might become stuck someday with this method. any advise
 
I was only suggesting that you could check the "Text" property of an unbound text box because you cannot check the "Value" property of an unbound text box. I was just pointing out that the Value and the Text properties of any text box are totally different properties and there have to be check differently.

If [txtbox]<>"" Then(basically does it have a value(curtacy of google))
In your example here you are by default checking the Value property of the text box.
 
thanks. i never knew there was a difference between text and a value. i knew that you can calculate value but never anything else.

i wonder mr b if you can quickly help me with this. its not a crucial part just a calculation.

=IIf(DateDiff('h',[TuesdayStartTime],[TuesdayFinishTime])>5,Sum(DateDiff('m',[TuesdayStartTime],[TuesdayFinishTime])-30),Sum(DateDiff('m',[TuesdayStartTime],[TuesdayFinishTime])\60)

what i am trying to do is calculate the time difference. if the hours are above 5 then minus 30 minutes(for break) if not above 5 then show the value. i have put \60 in the false statement but i would also like it in the true statement but i thought it might just look too boggled if i did.

and eventually calculate the working week. if a staff member works longer than 5 hours they are entitled to a break of 30 minutes so i would like to deduct this. in the end i would like to calculate all of them together to get the weeks hours but im starting at day by day.
 
I am not positive that I understand what you are needing help with.

You can do the entire calculation and it really should not bog thins down at all. I would be something like:

=IIf(DateDiff('h',[TuesdayStartTime],[TuesdayFinishTime])>5,Sum(DateDiff('m',[TuesdayStartTime],[TuesdayFinishTime])-30)/60,Sum(DateDiff('m',[TuesdayStartTime],[TuesdayFinishTime])/60)
 
thanks for helping mr. b. i need help with this as the expression dosent work. i can get it where it has it in munutes but as for turning it back to hours it comes up with an error.

i dont know why but its just not happening. i do feel that i have gained so much which enables to do these kind of things but i am just missing the 'rules' now.

il have a play with the expression as i have noticed that you have put the \60 outside of the Sum. so ill follow this rule and report back.

thank once again
 

Users who are viewing this thread

Back
Top Bottom