Macro If - Else statement Not Working

@ gasman..Can you explain y does the statement sends email when we just put numeric in if statement..

If the statement is true then the code will be executed.?

You said that your control for some strange reason was text, so I suggested using "8", only to see what it contained instead of getting the type mismatch error.

If for some strange reason it is a string, then using Val as arnelgp suggested would allow you to compare as numeric.

Personally I'd be investigating why it is not numeric, but then again, I'd be using VBA to do this. :-)
 
@Gasman ..thanks for the explanation and your time..I will work on that
 
@arnelgp..I have mailed you my db file
 
I hope this is what you want to accomplish.
First I created a data macro on RecordTable
Then I call that macro inside "Email to Manager Ver2" macro.
Please study the codes.
 

Attachments

@arnelgp..thank you for the help ..yeah this is what i tried..but can you tell me how you created the macro RecordTable.TestForEightHrsOrMore and where can i find the codes for that. I think the worktime is modified from 00:00:06 AM to 12:00:06 AM , in that case every macro will just execute the if statement rite..becoz every value is greater than 8..??
 
if its 8 hrs or more the macro will run.

you can view the macro code when you open RecordTable in design view. On the ribbon Create Data Macros->Create/Edit Named Macros.
 
@arnelgp..hey i just saw code and it was working fine , i used a query yest to find the same and it worked but using if-else is more simple i guess..thanks for helping
 
there are always better alternative approach, you just have to search more.
 

Users who are viewing this thread

Back
Top Bottom