ms access 2007 - How do I add Error message if my me.combo box is not selected for the following code? -


add error message if me.combo box not selected following code?

private sub command1_click() dim recipient string dim recipientcc string recipient = me.combo10.column(2) recipientcc = me.combo10.column(3) dim datetext string datetext = format(date - iif(weekday(date) < 3, 1 + weekday(date), 1), "mm-dd-yyyy")  docmd.transfertext acexportdelim, , "watchdog", "g:\common\auto finance\watchdog\watchdog_" & [datetext] & ".csv", true      'send email     dim olapp outlook.application     dim olmail outlook.mailitem       'get application     on error resume next     set olapp = getobject(, "outlook.application")     if olapp nothing set olapp = new outlook.application     on error goto 0      set olmail = olapp.createitem(olmailitem)     olmail         .subject = "indirect auto watchdog file"         .recipients.add [recipient]         .cc = [recipientcc]         .attachments.add "g:\common\auto finance\watchdog\watchdog_" & [datetext] & ".csv"         .body = ""         .display 'this display message check , send          '.send ' send message straight away     end  msgbox "email sent" end sub 

why not add if...else loop?

private sub command1_click()  if me.combobox.value<>""    'do task here else    'display error message end if end sub 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -