Error going from first field to last field in previous record

J

Jason

The following codes works except for when I use shift tab to go from the
first field to the last field in the previous record.

The error is: Run-time error '2455':
You entered an expression that has an invalid reference to the property
Form/Report.
The property may not exist or may not apply to the object you specified.

If Nz(DVDrecID, 0) = 0 Then
DVDProgListSubform.Form.AllowAdditions = False
Else
DVDProgListSubform.Form.AllowAdditions = True
End If

it's the second to last line.

Thanks,
J.
 
W

Wayne-I-M

Hi Jason

You need to trap the error

Just little thing but it's not a good idea to use the ID field for anything
other than create a specific reference to a unique record. Up to you though.

anyway, instead of using the ID to check if it's 0 why not just step through
the reocrds available and put an erro trap in if you get to the 1st record -
again, up to you.

something like this would work fine on a button or change it to someother
event


Private Sub ButtonName_Click()
On Error GoTo Err_ButtonName_Click
DoCmd.GoToRecord , , acPrevious
Exit_ButtonName_Click:
Exit Sub
Err_ButtonName_Click:
MsgBox "This is the first record", vbOKOnly, "Please Stop Pressing The
Button"
Resume Exit_ButtonName_Click
End Sub


HTH
 
J

Jason

I don't get what you are saying

The ID is a unique identifier (autonumber). I use error trapping but is
disabled while diagnosing the fault. Why stop pressing the buttons when
going to a previous record should just work like pressing the back play
button? I was using SHIFT-TAB not a back button. the code is in the
form_on_current event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top