Search results

  1. J

    When form opens buttons dont work until I hit New then they work

    They were working alright until I added this Private Sub Delrec_Click() Dim Response Response = MsgBox("Are you sure you want to delete this Booked Appointment?", vbYesNoCancel + vbCritical, "KlassicKutts") If Response = vbYes Then CurrentDb.Execute ("DELETE * FROM tblAppointments WHERE...
  2. J

    When form opens buttons dont work until I hit New then they work

    Option Compare Database Private Sub cboGoToRecord_AfterUpdate() On Error Resume Next Dim rst As Object Set rst = Me.RecordsetClone rst.FindFirst "AppointmentId = " & Me.cboGoToRecord.Value Me.Bookmark = rst.Bookmark End Sub Private Sub cmdBack_Click() On Error Resume Next...
  3. J

    Run Time Error 3070

    Thank You JHB Worked a treat :)
  4. J

    Run Time Error 3070

    I am setting up a custom record selector from fontstuff.com and am having a problem. I think the problem is that the primary key (CustomerId) is not an autonumber and contains text. here is the code: Private Sub cboGoToRecord_AfterUpdate() On Error Resume Next Dim rst As Object Set...
  5. J

    Custom Error message 3022

    Thank You I'll Try that. James
  6. J

    Custom Error message 3022

    I've Started from scratch coded the buttons and got the error message to work but am having problems with the button navagation. Here is the code: Private Sub cmdBack_Click() On Error Resume Next DoCmd.GoToRecord , , acPrevious End Sub Private Sub cmdNew_Click() On Error Resume...
  7. J

    Custom Error message 3022

    I've went back to the beginning Option Compare Database Private Sub Form_Error(DataErr As Integer, Response As Integer) If DataErr = 3022 Then MsgBox ("This appointment has already been booked") Response = 0 End If End Sub This works if I add an appointment. What do I do if...
  8. J

    Custom Error message 3022

    this is the original code before i add the buttons Private Sub Form_Error(DataErr As Integer, Response As Integer) If DataErr = 3022 Then MsgBox ("You have violated the primary key.") Response = 0 End If End Sub James
  9. J

    Custom Error message 3022

    i have changed it as per your suggestion but now it doesnt add the record this is the code now Option Compare Database Private Sub Command16_Click() On Error GoTo Err_Command16_Click DoCmd.GoToRecord , , acNewRec Exit_Command16_Click: Exit Sub Err_Command16_Click: If Err.Number = 3022 Then...
  10. J

    Custom Error message 3022

    The shop is only open from 9.00 am to 9.00pm so instead of using the time function of access I have set up a simple entity for time. I thought this was the best way. the database works with this. Its just this error message. I can get it to work but as soon as i add the buttons for nav it doesnt...
  11. J

    Custom Error message 3022

    I really appreciate you guys taking the time to respond to this. I know I am a complete newbie and this is a simple database. Its probably so simple that i feel stupid. I am sorry.
  12. J

    Custom Error message 3022

    I understand what your saying and i am going to work on the database to make it look professional. Its just i was so please when i got the double booking working i wanted to change the error mess to a custom one. After changing the line you suggested I am getting a response as in the new...
  13. J

    Custom Error message 3022

    when I use the button now i get an error as in screenshot James
  14. J

    Custom Error message 3022

    I just need the custom error message 3022 to say " this appointment is already taken" in stead of the default access one. if I could get this to work my troubles would be over. I am totally lost.
  15. J

    Custom Error message 3022

    Thanks jdraw. But I really must be doing something wrong. the button still not working. Its really a simple database and i dont really code except for this bit in double booking. Heres the code I have cut and pasted from your reply Option Compare Database Private Sub Command16_Click() On...
  16. J

    Custom Error message 3022

    heres a copy of my db
  17. J

    Custom Error message 3022

    Thanks I really appreciate your patience. But I dont understand. Where di I put this code I really dont know what I'm doing. If you could post the entire code your suggesting this would help me . I'm sorry for the hastle. James
  18. J

    Custom Error message 3022

    Thanks for the quick reply. I have added the code as you you suggested now the button won't add a record. Heres my code now Private Sub Command16_Click() On Error GoTo Err_Command16_Click DoCmd.GoToRecord , , acNewRec Err_Command16_Click: If Err.Number = 3022 Then MsgBox "This appointment...
  19. J

    Custom Error message 3022

    I've added a button to add a new record and tried to add error handling. but the code isn't working. here is the new code. Private Sub Command16_Click() DoCmd.GoToRecord , , acNewRec Err_Command16_Click: If Err.Number = 3022 Then MsgBox "This appointment has already been taken...
Back
Top Bottom