Code Stopped working

  • Thread starter Thread starter ChoonBoy
  • Start date Start date
C

ChoonBoy

I am using Access 2003. The codes below works well, but suddenly it looses
its ability to locate a particular record. It will just go to another
unrelated record.
Any idea why, please advice, thanks

DoCmd.OpenForm "Expense Reports", , , , acEdit
If IsLoaded("Expense Reports") Then
If Forms![expense reports]![expense
subform].Form.RecordsetClone.RecordCount > 0 Then
DoCmd.FindRecord Forms![expense reports by group]![Expense
Reportka Subform].Form![ExpenseReportID]
End If
End If
 
It seems to be looking for *any* value of ExpensseReportID. What makes it an
unrelated record?
 
Thanks for the reply,

I switched to this code which takes me to the exact record but unfortunately
I cannot scroll to others as it is filtered.

Dim stLinkCriteria As String

stLinkCriteria = "[Expenseid]&[expenserptname]= """ & Forms![expense reports
by group]![Expense Reportka Subform]![ExpenseID] & Forms![expense reports by
group]![Expense Reportka Subform]![ExpenseRptName] & """"
DoCmd.OpenForm ("Expense Reports"), acNormal, , stLinkCriteria, ,
acWindowNormal

Mike Painter said:
It seems to be looking for *any* value of ExpensseReportID. What makes it an
unrelated record?
ChoonBoy said:
I am using Access 2003. The codes below works well, but suddenly it
looses its ability to locate a particular record. It will just go to
another unrelated record.
Any idea why, please advice, thanks

DoCmd.OpenForm "Expense Reports", , , , acEdit
If IsLoaded("Expense Reports") Then
If Forms![expense reports]![expense
subform].Form.RecordsetClone.RecordCount > 0 Then
DoCmd.FindRecord Forms![expense reports by group]![Expense
Reportka Subform].Form![ExpenseReportID]
End If
End If
 
Back
Top