Code Stopped working

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
 
M

Mike Painter

It seems to be looking for *any* value of ExpensseReportID. What makes it an
unrelated record?
 
C

ChoonBoy

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
 

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