A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Linking forms



 
 
Thread Tools Display Modes
  #1  
Old October 13th, 2004, 12:35 PM
Edgar Thoemmes
external usenet poster
 
Posts: n/a
Default Linking forms

I have a table called frm_supplies which displays address and contact info
from the table tbl_suppliers. I also have a separate form called
frm_commodity which holds the supplier commodity groups from tbl_commodity,
what I would like is to click a button in the frm_suppliers and for it to
load up the frm_commodity with the suppliers info who was displayed on the
form when I clicked the button to be displayed. I have tried to do this a
number of different ways but no joy as of yet, could anyone point me in the
right direction?
  #2  
Old October 13th, 2004, 03:12 PM
Brian
external usenet poster
 
Posts: n/a
Default

"Edgar Thoemmes" wrote in message
...
I have a table called frm_supplies which displays address and contact info
from the table tbl_suppliers. I also have a separate form called
frm_commodity which holds the supplier commodity groups from

tbl_commodity,
what I would like is to click a button in the frm_suppliers and for it to
load up the frm_commodity with the suppliers info who was displayed on the
form when I clicked the button to be displayed. I have tried to do this a
number of different ways but no joy as of yet, could anyone point me in

the
right direction?


If I understand you correctly, what you need to do is to use the OpenForm
method with a WhereCondition e.g.

DoCmd.OpenForm "frm_commodity", WhereCondition := "supplier_id=" &
[supplier_id]

This assumes that the foreign key in tbl_commodities that identifies the
supplier is called supplier_id, and that it is a number. If it's text, do
it like this instead:

DoCmd.OpenForm "frm_commodity", WhereCondition := "supplier_id=""" &
[supplier_id] & """"


  #3  
Old October 13th, 2004, 04:35 PM
Edgar Thoemmes
external usenet poster
 
Posts: n/a
Default

Hi

Something I should probably have mentioned is that the commodities and the
suppliers table are linked through a junction table. I take it there would be
a different bit of code for this?

Thanks


"Brian" wrote:

"Edgar Thoemmes" wrote in message
...
I have a table called frm_supplies which displays address and contact info
from the table tbl_suppliers. I also have a separate form called
frm_commodity which holds the supplier commodity groups from

tbl_commodity,
what I would like is to click a button in the frm_suppliers and for it to
load up the frm_commodity with the suppliers info who was displayed on the
form when I clicked the button to be displayed. I have tried to do this a
number of different ways but no joy as of yet, could anyone point me in

the
right direction?


If I understand you correctly, what you need to do is to use the OpenForm
method with a WhereCondition e.g.

DoCmd.OpenForm "frm_commodity", WhereCondition := "supplier_id=" &
[supplier_id]

This assumes that the foreign key in tbl_commodities that identifies the
supplier is called supplier_id, and that it is a number. If it's text, do
it like this instead:

DoCmd.OpenForm "frm_commodity", WhereCondition := "supplier_id=""" &
[supplier_id] & """"



  #4  
Old October 14th, 2004, 09:30 AM
Brian
external usenet poster
 
Posts: n/a
Default

"Edgar Thoemmes" wrote in message
...
Hi

Something I should probably have mentioned is that the commodities and the
suppliers table are linked through a junction table. I take it there would

be
a different bit of code for this?

Thanks


Yes, that makes a difference! Your WhereCondition gets more complicated,
something like this:

WhereCondition := "commodity_id IN (SELECT commodity_id FROM
suppliers_commodities WHERE supplier_id = " & [supplier_id] & ")"


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
linking forms (without using sub forms) & writing a macro Adena Using Forms 1 September 27th, 2004 01:24 AM
linking 3 forms to move to the same record levi Using Forms 4 August 11th, 2004 11:48 PM
Linking data between forms Paul Using Forms 3 June 23rd, 2004 08:03 PM
Linking Forms to Help Files Colin Halliday Using Forms 0 June 18th, 2004 05:47 AM


All times are GMT +1. The time now is 01:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.