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...
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...
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...
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...
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...
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
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...
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...
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.
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...
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.