View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ker_01 ker_01 is offline
external usenet poster
 
Posts: 395
Default data populated multiple times through excel form


Immediately after your warning msgbox line of code, add:
Exit Sub

This should be done within the loop that checks to verify that all mandatory
fields have data, e.g.

If mandatoryBoolean = False then
msgbox "you forgot to fill in all mandatory fields",,"Idiot"
Exit sub
endif

HTH
Keith

"sam" wrote:

One issue I am having with my code is, On my excel form, I have text boxes,
radio buttons, and check boxes. And I have marked some fields as mandatory,
i.e. If users clicks submit button without filling out these mandatory
fields, they will see a popup msg box asking them to input data in these
fields.

The issue is: If a user forgets to input data in a mandatory field, A msgbox
is displayed to remind user to populate. Once the user clicks ok on the
msgbox, then inputs the data in the mandatory field and clicks submit the
data in excel sheet is populated twice. One without the mandatory field(first
click on submit by user) and One with the mandatory field in a new row(second
click on submit button after user is reminded of the mandatory field)

I hope I made it clear.

Thanks a LOT in advance.