View Single Post
 
Old 05-07-2015, 08:30 AM
orozvik@yahoo.com orozvik@yahoo.com is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Apr 2015
Posts: 8
orozvik@yahoo.com is on a distinguished road
Unhappy UserForm textbox exit event activated with navigation buttons...why? help?

HI Can anyone offer help on my invoice entry Excel User Form? here is the issue.

I have the following line of code for the cutomer number textbox in the form:
Private Sub txtBillToCust_Exit(ByVal Cancel As MSForms.ReturnBoolean)

'Checks the txtBillToCust field for a blank entry
If txtBillToCust = vbNullString Then
txtBillToCust.BackColor = &HFF&
MsgBox "Please enter the 8-digit Customer Number"
Cancel = True
End If

End Sub

This code will highlight the textbox with red color, prompt the user to enter the custmer number and finally clear the color and return the user to the text box where they can enter the customer number.

However, this code is causing issues with the First, Previous, Next, Last, Save File, Close navigation buttons....as when i click on any of these buttons, they do not function and the customer textbox continues to prompt me for the custmer number as the code above appears to continue.

My guess is that the exit event on the customer textbox is being activated whenever any of the navigation buttons are being depressed. I do not know why this is.

Does anyone know how to correct for this? do i need to add some error handling or other code to the cmdNext, cmdPrevious and other buttons? Or is there something i need to add to the customer textbox exit sub procedure listed above?

any help would be greatly appreciated as i am just dumbfounded at this time.

Thank you in advance.
Reply With Quote