Re: Next & Previous buttons don't display data correctly in Access
- From: "C. Stanton" <CStanton@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 17 Jan 2006 06:07:05 -0800
Bruce,
I have inherited a small system that was designed by someone who left no
documentation and is no longer contactable.
The data that is displayed incorrectly is either shown as a null field or
the value last entered in that field on the screen is shown (i.e. if a new
was created or record was changed, then whatever was last entered on the
screen on the form in this field, then this value is displayed for all
records). NOTE - it is only display that is incorrect - the database remains
correct. All fields concerned are Unbound fields that exist on other tables,
except one field that exists on the table the form is based upon and is
displayed as a combo box.
The custom ''previous record'' button has the following code :-
Private Sub cmdcalldetailprevious_Click()
On Error GoTo Err_cmdcalldetailprevious_Click
DoCmd.GoToRecord , , acPrevious
Me.Refresh
Exit_cmdcalldetailprevious_Click:
Exit Sub
Err_cmdcalldetailprevious_Click:
Select Case Err.Number
Case Is = 2105
Exit Sub
Case Else
MsgBox Err.Description
Resume Exit_cmdcalldetailprevious_Click
End Select
End Sub
The ''Next Button'' is exactly the same except that word previous is
replaced with the word next.
The custom print button is supposed to print of a report version of the form
where the code is as follows :-
Private Sub cmdPrintCallDetail_Click()
On Error GoTo Err_cmdPrintCallDetail_Click
Dim stDocName As String
stDocName = "rptCallDetails"
DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=[Forms]![frmMain]![ID]"
Exit_cmdPrintCallDetail_Click:
Exit Sub
Err_cmdPrintCallDetail_Click:
MsgBox Err.Description
Resume Exit_cmdPrintCallDetail_Click
End Sub
Would I be correct in thinking thta if the Form error is resolved, this
would then be reflected in the print function too?
FYI - if I take the Print Function from the tool bar then every record is
printed, and again the fields mentioned before are incorrect.
I hope this answers all your questions and provides more clarification to my
problem.
Your help is greatly appreciated,
regards,
C. Stanton
"BruceM" wrote:
> Are you referring to the record navigation buttons at the bottom of the form
> next to the record counter? In what way is the data incorrect? What is the
> code behind the custom buttons? Did you use a wizard to create the Print
> button? What does it do, and what are you expecting instead? What is the
> code behind the Print button?
>
> "C. Stanton" <C. Stanton@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:AA7E5073-C8C8-4677-BFDA-C0F962B13403@xxxxxxxxxxxxxxxx
> > The default Next & Previous Butttons do not retrieve the data correctly
> > from
> > an Access database - this is also true of the Print Button functionality.
> > However, the default buttons are not used but custom ones are added, the
> > data is displayed correctly.
> > I am unable to find how corect the default buttons.
>
>
>
.
- Follow-Ups:
- References:
- Prev by Date: button to open another form with same record
- Next by Date: Re: button to open another form with same record
- Previous by thread: Re: Next & Previous buttons don't display data correctly in Access
- Next by thread: Re: Next & Previous buttons don't display data correctly in Access
- Index(es):