User Form Coding

B

bern

Hi All
Could somebody look at my coding (below)
I have a user form that makes appointsments by adding data to a booking
sheet. That works fine. But I have also have a command button to open
another form to cancel or reshedule the appointments. In order to find
a client and the appointment details I use the below code. But I can't
seem to get it to work. Any help please.

Appoitment worksheet
A..........B...........C................D......................E..........F........G.....H
custID..Surname..First Name..Contact
number..Salon..Date..Time..Treatment

Bookings worksheet
A..........B...........C................D......................E..........F........G.....H
custID..Surname..First Name..Contact
number..Salon..Date..Time..Treatment

Private Sub txbcustid_KeyDown(ByVal KeyCode As MSForms.ReturnInteger,
ByVal Shift As Integer) 'tab key
Application.ScreenUpdating = False
Dim myclient
If KeyCode = "9" Or KeyCode = "13" Then
With frmReshedule
myclient = .txbsurname
On Error Resume Next
Cells.Find(What:=myclient, lookat:=xlWhole).Activate
If Err = 91 Then
MsgBox "Sorry could not find ClientId :" & myclient
..txbsurname = ""
..txbsurname.SetFocus
Application.SendKeys "+{tab 1}", True
Exit Sub
End If
..txbcustid.Value = ActiveCell.Offset(, 0).Text
..txbfirstname.Value = ActiveCell.Offset(, 2).Text
..txbcontactnumber.Value = ActiveCell.Offset(, 3).Text
..txbsalon.Value = ActiveCell.Offset(, 4).Text
..txbdate.Value = ActiveCell.Offset(, 5)
..txbtime.Value = ActiveCell.Offset(, 6)
..txbtreatment.Value = ActiveCell.Offset(, 7).Text
End With
End If
End Sub

Bern :confused:
 
Top