Active Member
February 4, 2021
Regards to all
Do hope I can get some enlightened help in fixing my problem.
I have a Worksheet named LEDGER SAMPLE. It has two worksheets Sheet1(SERVICE FEE PAYMENT) and Sheet2(FUEL FEE PAYMENT). Upon opening the User form the basic procedure is that you are required first to select the identity code of the customer from a list or alternatively type in the identity code. If correct or existing identity code is entered the corresponding name of customer appears in the Name box. You specify the type of Payment in the Payment combo box, followed by amount of payment and finally the date which in this example is limited between 1 January 2021 to 16 January 2021. When Enter key is pressed the amount is duly entered into the respective worksheet at the intersecting cell point of Name and ID code (Row) and specified date (Column).
My desire is to be able to select the Id No code from the combo box list or alternatively type in the No Code which in this case should one enter a wrong Id No Code the Message: None Existent ID Code. Please Check and Renter appears allowing the user to delete wrong entry and retype the correct entry. I have tried making readjustments to my code in the cboID combo box to no avail.
Will gladly appreciate some willing guidance on how to go about this.
Regards
Carlos
Trusted Members
February 13, 2021
You're there! The only changes you need to make are to move the "on error" command before your value command and exit the sub before your msgbox error. Tweak your code like that shown below and I believe you are where you want to be. 🙂
With Me.cboID
On Error GoTo 1
Me.TextBox2.value = .List(.ListIndex, 0)
End With
Exit Sub
1:
MsgBox "None Existent ID Code.Please Check and Renter"
Exit Sub
End Sub
Answers Post
Active Member
February 4, 2021
Cheers Jessica
Its 9:19 am and a bright optimistic Friday morning here in Kenya so allow me to wish you a Good morning.
Thank you very much for your code solution. Very simple and efficient. My form is fully functional now and worthy of a demo to my students.
I am indeed grateful for your assistance. On this Christmas Eve. May I wish you a Happy Christmas and a Blessed New Year.
Regards and Cheers
Carlos
1 Guest(s)