> Hi,
>
> I have a staff details form which has a link to a training record form. I
> would like this link to go to the same staff member as the one shown on
> the
> details form. How would I go about this?
I think we need more info but I'll assume that you have a 'staff' table and
a 'training' table with a one-to-many relationship between them and that
your 'staff details' form is the main form and 'training record' is its
subform. If this is the case then you need a parent/child data link on your
primary and foriegn keys.
> We also have links to queries and reports on the same page which I have
> managed to synchronise with the details form but synchronising another
> form
> appears to be more difficult.
I'm confused by the use of the word 'synchronise' here. Forms can have data
sources which can be tables and/or queries. As I say I thnk more info is
required but is sounds as if you may have a fundamental relationship problem
at table level. Perhaps you could detail what relationships exist, if any.
I would have expected there to be a 1:M between staff and training, since
each staff member could go on many training courses.
> My VB skills are virtually non existent.
>
> Please help
>
> Ian
Keith.
www.keithwilby.com
NoviceIan - 25 May 2006 11:16 GMT
Sorry, yes i do have a 1 to many relationship staff being on the 1 side as
you mentioned.
The forms at the moment are not linked. What I meant was I would like a
button on my main staff details form to open the training record form for the
staff member I am currently viewing.
Does that make sense. Just in case if I was looking at John Smith's
personal details and decided I wanted to view his training record, then I
would like to be able to click a button which will open the training record
form to his own record.
Thanks for helping me.
> > Hi,
> >
[quoted text clipped - 30 lines]
> Keith.
> www.keithwilby.com
Keith Wilby - 25 May 2006 11:37 GMT
> Sorry, yes i do have a 1 to many relationship staff being on the 1 side as
> you mentioned.
[quoted text clipped - 11 lines]
>
> Thanks for helping me.
Ah right. Use the value from a PK text box on your main form to filter the
form being opened (untested):
DoCmd.OpenForm "frmTraining",,,"[ForiegnKeyFieldName] = " & Me.txtPrimaryKey
HTH - Keith.
www.keithwilby.com
NoviceIan - 25 May 2006 12:39 GMT
I've tried messing around with that code but my VB skills are non existent
I'm affraid i use macros where ever possible which are generally fine for my
purposes.
Could you please help me a little more sorry to be a dunse.
The From I'm opening from is Staff Details
The form I wish to open is Training Mainform
The linked fields are Staff Number
> > Sorry, yes i do have a 1 to many relationship staff being on the 1 side as
> > you mentioned.
[quoted text clipped - 19 lines]
> HTH - Keith.
> www.keithwilby.com
Keith Wilby - 25 May 2006 13:14 GMT
> I've tried messing around with that code but my VB skills are non existent
> I'm affraid i use macros where ever possible which are generally fine for
[quoted text clipped - 6 lines]
> The form I wish to open is Training Mainform
> The linked fields are Staff Number
All you need to do is substitue the generic object names I've supplied with
your actual names:
DoCmd.OpenForm "Training Mainform",,,"[Staff Number] = " & Me.txtPrimaryKey
txtPrimaryKey is the name of the *control* which is bound to your main
table's Primary Key (ie, its *control* name and not the *field* name,
although Access may have made them the same). Also make sure you have those
three commas after the form name. Post back if you're still stuck.
Keith.
NoviceIan - 25 May 2006 14:00 GMT
Its "Method or data member not found" and highlights the primarykey text in
the code.
> > I've tried messing around with that code but my VB skills are non existent
> > I'm affraid i use macros where ever possible which are generally fine for
[quoted text clipped - 18 lines]
>
> Keith.
Keith Wilby - 25 May 2006 14:49 GMT
> Its "Method or data member not found" and highlights the primarykey text
> in
> the code.
I've just tested my code on a very simple setup and it works. Can you post
the code that fails please?
David M C - 25 May 2006 17:04 GMT
You need to substitute txtPrimaryKey for the name of your textbox/combobox
that uniquely identifies the record. If you right click the textbox, click
properties, and click the "other" tab, you can see the name. You might habe
to surround the name in [] brackets if it has a space in it.
> Its "Method or data member not found" and highlights the primarykey text in
> the code.
[quoted text clipped - 21 lines]
> >
> > Keith.