Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with focus on records

Status
Not open for further replies.

MrCroquet

Programmer
Dec 20, 2006
13
0
0
CA
Our order entry database was created initially from the Access Wizard-generated "Order Entry" database. When new, it would recognize which order was highlighted (by the black arrow beside the order record). On clicking the "Orders" button, it would open the Orders subform, going directly to THAT order number.

Some time ago, our database lost that ability to go to that specific order record. Now when the Orders button is clicked, it opens the Orders subform but I need to scroll through the orders to find the one I want. Searching high & low, I can't seem to see any changes from the original Wizard-generated version and our current one.

For reference, when opening the Payment form and Invoice report, the highlighted order record IS recognized. Any thoughts on where the focus is being lost?
 
ok now can you paste the on click event

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
You might have lost the connection between OrderID on the main and subform. Check if the NAME of the field still is OrderID.


Pampers [afro]
Keeping it simple can be complicated
 
this is what it sounds to me therefor i asked to see his code

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
How are ya MrCroquet . . .
MrCroquet said:
[blue]On clicking the "Orders" button, it would open the [purple]Orders subform[/purple], going directly to THAT order number.[/blue]
Actually it opens the [purple]Orders Form[/purple].

Anyway . . . [blue]filtering[/blue] for the Orders Form occurs in the Orders Form [blue]OnActivate[/blue] event. The following is the code for that event [blue]from a newly generated Orders DB.[/blue] Compare your code to this and if any differences you know what to do (be sure to backup your current code):
Code:
[blue]Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
    Me.Requery
    If IsLoaded("Orders by Customer") Then
        If Forms![Orders by Customer]![Orders by Customer Subform].Form.RecordsetClone.RecordCount > 0 Then
            DoCmd.GoToControl "OrderID"
            DoCmd.FindRecord Forms![Orders by Customer]![Orders by Customer Subform].Form![OrderID]
        End If
    End If

Exit_Form_Activate:
    Exit Sub

Err_Form_Activate:
    MsgBox Err.Description
    Resume Exit_Form_Activate
End Sub[/blue]

If the code is intact you may need to import The Orders Form from a backup or newly generated DB. Other checks may prove this unecessary.

BTW: what version Access?

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks for the thorough reply. First, the easy stuff. I'm running Access 2000. Now, (2 hours later . . .) Compared the coding for the OnActivate event and sure enough, there was the problem. The DoCmd line referred to "EmployeeID" instead of OrderID. Editing that one line fixed a problem that I've been cursing for almost a year now.

Thanks TheAceMan1 and Merry Christmas too all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top