Buttons don't lead to the desired record

G

Gosha

Hi
I am working on a database and I need to have buttons refering to other
forms on my main form.
I have tried the wizard and macro builder - know nothing about VBA.
The problem is that when e.g. I am looking at funder no12 on the main form I
click on the button 'contacts', the contact form appears but shows contact
for funder no1 - so it always shows funder no1 - no matter what funder I am
looking at.
I have one-to-many relationships created all conected bu Funder Id field and
it a PK in one table only.
What weird to me is that i already have a subform on the main form and it
connects two tables with no problems - but i can have another subform on the
main form - no more space.
Please help!
Thanks
 
K

Klatuu

What you are seeing is normal. Forms and Subforms are linked together using
the Link Master and Link Child Field properties. But, since each form has
its own recordset and there is no relationship between the forms, you have to
control which record is displayed.

There are a number of ways to do this, but the easiest is to use the Where
condition of the OpenForm Action or Method. Since you are using Macros, you
will want to use the OpenForm Action. In the macro builder, you will see the
Where Condition argument. You use that argument to tell the form which
record to show when it opens.
 
S

Steve

The code or macro in the click event of your button uses the OpenForm method
to open the contacts form. Look at OpenForm in the Help file to find how to
open a form to a specific record. Your code (or macro) needs a slight
modification.

Steve
(e-mail address removed)
 
G

Gosha

Hi
Thanks for your reply.

I have already tried openform action macro

when i use the wizard i select matching fileds as Contacts![Funder Id] and
Funders![Funder Id] then i get a where condition put in automaticaly by
access. when i go to properties it looks like that:

"[Funder ID]=" & [Funder ID]

I ve tried to modify it to:

[Funder ID]=Forms![Funders]![Funder ID]

but the access automatically add brackets around the 'Forms!'

and when i try to run the modifed macro i get prompt:
'Enter Parameter Value'
Forms!Funders!Funder ID
______________________

when i type the desired number it goes to it.......

but as you might imagine that is not what i need.

Do you know why this happens?
I have searched everywhere...:(
 
G

Gina Whipp

Gosha,

Try "[Funder ID]=" & Forms![Funders]![Funder ID]

However, I wonder which form you are actually on when you try to run this
Where condition. Perhaps you should explain a bit further what you are
trying to do.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Gosha said:
Hi
Thanks for your reply.

I have already tried openform action macro

when i use the wizard i select matching fileds as Contacts![Funder Id] and
Funders![Funder Id] then i get a where condition put in automaticaly by
access. when i go to properties it looks like that:

"[Funder ID]=" & [Funder ID]

I ve tried to modify it to:

[Funder ID]=Forms![Funders]![Funder ID]

but the access automatically add brackets around the 'Forms!'

and when i try to run the modifed macro i get prompt:
'Enter Parameter Value'
Forms!Funders!Funder ID
______________________

when i type the desired number it goes to it.......

but as you might imagine that is not what i need.

Do you know why this happens?
I have searched everywhere...:(



Klatuu said:
What you are seeing is normal. Forms and Subforms are linked together
using
the Link Master and Link Child Field properties. But, since each form
has
its own recordset and there is no relationship between the forms, you
have to
control which record is displayed.

There are a number of ways to do this, but the easiest is to use the
Where
condition of the OpenForm Action or Method. Since you are using Macros,
you
will want to use the OpenForm Action. In the macro builder, you will see
the
Where Condition argument. You use that argument to tell the form which
record to show when it opens.
 
G

Gosha

Hi Gina

Thank for you reply.

I copied what you wort into where condition. When I run the macro it prompts
for the parameter value again :(

I am trying to open the contacts form from the Funders form which is my main
form.

Thank again

Gosha


Gina Whipp said:
Gosha,

Try "[Funder ID]=" & Forms![Funders]![Funder ID]

However, I wonder which form you are actually on when you try to run this
Where condition. Perhaps you should explain a bit further what you are
trying to do.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Gosha said:
Hi
Thanks for your reply.

I have already tried openform action macro

when i use the wizard i select matching fileds as Contacts![Funder Id] and
Funders![Funder Id] then i get a where condition put in automaticaly by
access. when i go to properties it looks like that:

"[Funder ID]=" & [Funder ID]

I ve tried to modify it to:

[Funder ID]=Forms![Funders]![Funder ID]

but the access automatically add brackets around the 'Forms!'

and when i try to run the modifed macro i get prompt:
'Enter Parameter Value'
Forms!Funders!Funder ID
______________________

when i type the desired number it goes to it.......

but as you might imagine that is not what i need.

Do you know why this happens?
I have searched everywhere...:(



Klatuu said:
What you are seeing is normal. Forms and Subforms are linked together
using
the Link Master and Link Child Field properties. But, since each form
has
its own recordset and there is no relationship between the forms, you
have to
control which record is displayed.

There are a number of ways to do this, but the easiest is to use the
Where
condition of the OpenForm Action or Method. Since you are using Macros,
you
will want to use the OpenForm Action. In the macro builder, you will see
the
Where Condition argument. You use that argument to tell the form which
record to show when it opens.
--
Dave Hargis, Microsoft Access MVP


:

Hi
I am working on a database and I need to have buttons refering to other
forms on my main form.
I have tried the wizard and macro builder - know nothing about VBA.
The problem is that when e.g. I am looking at funder no12 on the main
form I
click on the button 'contacts', the contact form appears but shows
contact
for funder no1 - so it always shows funder no1 - no matter what funder
I am
looking at.
I have one-to-many relationships created all conected bu Funder Id
field and
it a PK in one table only.
What weird to me is that i already have a subform on the main form and
it
connects two tables with no problems - but i can have another subform
on the
main form - no more space.
Please help!
Thanks
 
G

Gina Whipp

Gosha,

Okay, then I will need the exact name of the Contacts form and the exact
name of the Funders form as well as the field names and what 'connects'
those two forms together, which might be Funder ID???

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Gosha said:
Hi Gina

Thank for you reply.

I copied what you wort into where condition. When I run the macro it
prompts
for the parameter value again :(

I am trying to open the contacts form from the Funders form which is my
main
form.

Thank again

Gosha


Gina Whipp said:
Gosha,

Try "[Funder ID]=" & Forms![Funders]![Funder ID]

However, I wonder which form you are actually on when you try to run this
Where condition. Perhaps you should explain a bit further what you are
trying to do.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Gosha said:
Hi
Thanks for your reply.

I have already tried openform action macro

when i use the wizard i select matching fileds as Contacts![Funder Id]
and
Funders![Funder Id] then i get a where condition put in automaticaly by
access. when i go to properties it looks like that:

"[Funder ID]=" & [Funder ID]

I ve tried to modify it to:

[Funder ID]=Forms![Funders]![Funder ID]

but the access automatically add brackets around the 'Forms!'

and when i try to run the modifed macro i get prompt:
'Enter Parameter Value'
Forms!Funders!Funder ID
______________________

when i type the desired number it goes to it.......

but as you might imagine that is not what i need.

Do you know why this happens?
I have searched everywhere...:(



:

What you are seeing is normal. Forms and Subforms are linked together
using
the Link Master and Link Child Field properties. But, since each form
has
its own recordset and there is no relationship between the forms, you
have to
control which record is displayed.

There are a number of ways to do this, but the easiest is to use the
Where
condition of the OpenForm Action or Method. Since you are using
Macros,
you
will want to use the OpenForm Action. In the macro builder, you will
see
the
Where Condition argument. You use that argument to tell the form
which
record to show when it opens.
--
Dave Hargis, Microsoft Access MVP


:

Hi
I am working on a database and I need to have buttons refering to
other
forms on my main form.
I have tried the wizard and macro builder - know nothing about VBA.
The problem is that when e.g. I am looking at funder no12 on the
main
form I
click on the button 'contacts', the contact form appears but shows
contact
for funder no1 - so it always shows funder no1 - no matter what
funder
I am
looking at.
I have one-to-many relationships created all conected bu Funder Id
field and
it a PK in one table only.
What weird to me is that i already have a subform on the main form
and
it
connects two tables with no problems - but i can have another
subform
on the
main form - no more space.
Please help!
Thanks
 

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