View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default user input recorded twice on excel sheet


Hey Libby, I already have an Exit Sub after each msgbox code, such as.

'check for Loan Amount
If Trim(Me.LoanAmt.Value) = "" Then
Me.LoanAmt.SetFocus
MsgBox "Please enter a Loan Amount"
Exit Sub
End If

This should work rite?





"Libby" wrote:

Hi Sam,

It sounds like you need an "Exit Sub" after the msgbox advising that a
mandatory field isn't filled in. This should prevent it going on to
populate.

The other way to do it would be to disable the Submit button unless the
mandatory fields were filled.
In this case you should start with the button enabled property = false. Then
you need a Sub that checks if the fields are filled and changes this property
to true if they are and false if they're not. This Sub would need to be
called at each change event for the all fields.


"sam" wrote:

Hello People!

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 popup msg box works great when user forgets to input a data in some
mandatory field, BUT the data in excel sheet is populated once the user
clicks submit button(without filling up a mandatory field).
Once I click the OK button on the msg box and input the data in the
mandatory field and click submit, the data is again populated in the excel
sheet in a new row.

I hope I made it clear.

Thanks a LOT in advance.