View Single Post
Old 05-29-2011, 08:13 AM   #5
z0001130
Newly Registered User
 
Join Date: May 2011
Posts: 8
Thanks: 6
Thanked 0 Times in 0 Posts
z0001130 is on a distinguished road
Re: Enable/disable Button depending on recordcount

Quote:
Originally Posted by gemma-the-husky View Post
but all you need to do is error trap the email button anyway

Code:
sub email_button_click
dim id as long 'used to detect an error below
 
on error goto fail
 
'if there is no current record this next line will error
'it doesn't have to be this - if you are call the email function with an argument , you don't need this. 'you just need something that will detect a blank form and not call the email 
 
id = recordid  
 
send email
exit sub
 
fail:
msgbox("no active record", & vbcrlf & vbcrlf & _
"error: " & err & "  Desc: " & err.description)
'I always like to show the error code
end sub
Thanks for the code, I had already done code to error trap the button, but I prefered to grey out button if there were no records.

Thanks
John
z0001130 is offline   Reply With Quote