Double Click Event

KTJ_SBS

Registered User.
Local time
Today, 02:33
Joined
Jan 7, 2005
Messages
11
Hi,

I have a form which has a tab control on it. The form itself is just based on 1 table (tblCustomers). The tab control has 2 pages. Page 1 shows some fields from tblCustomers.

Page 2 of the tab control shows 2 embdedded forms. Those forms are based on queries created from tblCustomers.

What i want to be able to do is when i see a company name in one of the ebedded forms, i want to be able to double click that record and it switches me back to page 1 and shows the the details of whichever company I double clicked.

I have changed the double click event in the emdedded form and using the builder to create something. i also added a setfocus command as i read about that somewhere (but i have no idea what it does). through this i managed to get it to switch pages when i double click but it only ever takes me to record 1.

any ideas?

thanks in advance :)
 
i also added a setfocus command as i read about that somewhere (but i have no idea what it does).

Setfocus puts the cursor in a particular control. Like, if you enter value 123 in TextBoxA and that value means that TextBoxB has no meaning so you should skip to TextBoxC (bypassing B), you would use SetFocus in the AfterUpdate of TextBoxA to detect this "invalidation" of TextBoxB so you COULD skip it and go straight to TextBoxC

As to the other problem, you have two issues. First, you must find the place where the double-click occurred. As it is in a sub-form, the question will be, where is the event intercepted? In the sub-form control, an on-click event DOES NOT KNOW where the click occurred except that it was inside the sub-form. That is because, from the parent form, the sub-form is a blob. However, in the form that is contained in the sub-form control, that particular form CAN know which record was clicked.

So part of your problem is, who's handling the click? parent or sub ? The next trick is to get the parent to change records based on an event that occurred in the sub-form. So the SUB-form (the only one that CAN know where the click occurred) must pass that information to its parent. A couple of ways exist to do this, one of which is to store the record number in a hidden (non-visible) field on the sub, then let the parent read the hidden field and reset itself when IT fields the click. The other way is to recognize that the parent of the sub-form exists and is called Me.Parent, which is a property you can look up. If there is a hidden field on the PARENT form, you can have the sub-form pass the correct record number "up the chain" and let it go at that.
 
thanks for your reply.

i understand the theory of what you suggested, but unfortunately as im a novice at access I'm not entirely sure how i go about this.

A couple of ways exist to do this, one of which is to store the record number in a hidden (non-visible) field on the sub, then let the parent read the hidden field and reset itself when IT fields the click

how do i make a reference to a record number? and how would I set up a command that made the parent field look it up.

I have a Customer ID number that exists in both the subs and in the main form. could i somehow set up a link that means when i click/double click the ID in the sub , it takes me to the same id in the main?

thanks in advance
:D
 

Users who are viewing this thread

Back
Top Bottom