A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Error going from first field to last field in previous record



 
 
Thread Tools Display Modes
  #1  
Old August 23rd, 2009, 12:01 AM posted to microsoft.public.access.gettingstarted
Jason[_38_]
external usenet poster
 
Posts: 21
Default Error going from first field to last field in previous record

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.


  #2  
Old August 24th, 2009, 05:31 PM posted to microsoft.public.access.gettingstarted
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default Error going from first field to last field in previous record

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

--
Wayne
Manchester, England.



"Jason" wrote:

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.



  #3  
Old August 25th, 2009, 09:38 AM posted to microsoft.public.access.gettingstarted
Jason[_38_]
external usenet poster
 
Posts: 21
Default Error going from first field to last field in previous record

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.

"Wayne-I-M" wrote in message
news
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

--
Wayne
Manchester, England.



"Jason" wrote:

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.

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





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:19 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.