"Going To" a record via a subform!

donkey89

Registered User.
Local time
Today, 12:51
Joined
May 14, 2011
Messages
17
Hello all,

Okay so I have two tables, tblCustomers and tblOrders. I have appropriate forms for both. On one of my forms being fmCustomers I have a subform which is called sfmCustomersOrders, which simply gives an overview of all orders designated to that customer.

Currently I have to remember the order number and go through to the orders form and then search for that record which is slightly error prone and somewhat inconvienient! So what I would like to do is be able to click the order I wish to view full details of and it takes me through to the main order form, and opens at the selected record.

I got slightly lost looking through other posts and got a little confused so I'm hoping somebody will be able to give me at least a link to a tutorial based on this!

Thankyou in advance, if I missed any key information I do appoligise, just ask!

~Markus
 

Thankyou pbaldy,

Using the information supplied by yourself, I tried to replicate something very similar to a previous query you helped me with, which was Linking a button on a form to a report but to only show the data I was currently viewing, so effectively the same as this!

However Im struggling. As I seem to find it far easier to use the Macro builder at this moment in time I did, So on the "Order Number" field of my subform I have added a on click event with a macro to open the appropriate form (fmOrders). I have then added a where condition as follows;

[Order Number]=[Forms]![sfmCustomerOrders]![Order Number]

This appears to only open up the orders form at a new record? With a little research I found that as I'm "calling" the data from a form within a form I have to add the parent form before the control name? This is all rather confusing at the moment!

I'm assuming my control source/name is Order Number? as thats the source of information I want to match? However thats about as far as I am with this, perhaps you could shed some light on it for me?

Much appreciated,

~Markus
 
Yes, when the form is a subform the syntax to reference it changes:

http://www.mvps.org/access/forms/frm0031.htm


Thankyou for your response pbaldy,

Now I'm possibly starting to sound rather slow but I can't seem to get my head around this.

So if I'm correct. I have a main form named fmCustomers, and the subform, sfmCustomerOrders is 'property' of fmCustomers in the way of another control, with a individual set of controls? so in essence, to get to the Order Number that is currently held in the subform, it is fmCustomers -> sfmCustomerOrders - > Order Number?

So if Order number in the orders form has to equal the above it would be,

[Order Number]=[Form]![fmCustomers]![sfmCustomerOrders].[Form].[Order Number]

or so I thought.. This doesnt appear to work. I click on the appropriate record within the subform and I'm then faced with a error box, asking me to enter the parameter value. If I enter the value of the order number I want it works, so its a step forward.

From this I assume my "path" is incorrect?

Hopefully you can assist me further, thankyou.

~Markus
 
The first one is "Forms" so try

[Order Number]=[Forms]![fmCustomers]![sfmCustomerOrders].[Form].[Order Number]

In case they're different, "sfmCustomerOrders" needs to be the name of the subform control on the main form, not the name of the subform.
 

Users who are viewing this thread

Back
Top Bottom