Next record button runtime error

cath_hopes

Registered User.
Local time
Today, 14:32
Joined
Oct 17, 2007
Messages
52
Hi there!

The first line of this procedure (If Me.LastRcd = True Then) is producing a runtime error 438 - 'Object does not support this property or method'. What code should I be using instead?

Private Sub NextRcd_Click()

If Me.LastRcd = True Then
MsgBox "No further Booking/ Job records exist for this property."
Else
DoCmd.GoToRecord , , acNext
End If

End Sub

Many thanks in advance,
Catherine
 
Code:
Private Sub nextRecordButton_Click()
On Error GoTo Err_nextRecordButton_Click
        DoCmd.GoToRecord , , acNext

Exit_nextRecordButton_Click:
    Exit Sub

Err_nextRecordButton_Click:
    MsgBox ("There are no other records")
    Resume Exit_nextRecordButton_Click
    
End Sub

is what i use
 
I've tried your coding but it doesn't produce the error message. Instead it produces a new record page ...
 
do you have dataentry turned off for this form?
 
The data entry property for the form is set to 'Yes' as are Allow Additions, Allow Edits, Allow Deletions.
 
do you want people to be able to add new ones? or just look through what is currently there?
 
There are two occasions when I want to allow users to add new records: firstly on load form if the no records for the filter exist in the first place and secondly if they click on a 'New Record' button that's on my form.
 
so just searching through the records you do not want them to be able to add correct?
i would turn dataentry off until the click of the new record button is clicked
 
I've just been thinking alongn the same lines and added some code to the new record button that first switches the Allow Additions property to true, opens a new record and then switches the Allow Additions property back to false again. Likewise I've done something similar to the form on load event to allow a new record if no other records in the filter exist and then switching the Allow Additions property back to false again.
I think that's cracked it.
My form finally works!!
Thanks for your help Ray.
 
you are welcome! glad you got it figured out
 

Users who are viewing this thread

Back
Top Bottom