dbTalk Databases Forums  

Help setting form value using data from a second table

comp.database.ms-access comp.database.ms-access


Discuss Help setting form value using data from a second table in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mario Sarno
 
Posts: n/a

Default Help setting form value using data from a second table - 01-16-2004 , 10:11 AM






Hi Guys,

I have a database that logs calls made by advisors in the Call Centre
where I work.

I have two tables:

tbl_Calls
tbl_Advisors

The tbl_Calls is where the details of the calls get stored, and has
the following fields, amongst others:

AccountName
Advisor
AdvisorManager
Comments
TimeOfCall

The tbl_Advisors table has the following fields (and is a linked table
from another database)

AdvisorName
TeamManager

I have created a form based on the tbl_Calls table where the call data
can be entered, and entering the data is fine, except for one snag....

I have a combo box on the form that links to the tbl_Advisors table,
and allows the user to select an advisor name without having to type
it in. I also have a textbox on the form that should contain the
manager's name, which again needs to be pulled in from the
tbl_Advisors table.

What I would like to happen, is when the user selects the Advisors'
name from the combo box, it will autopopulate the AdvisorManager field
with that advisor's Team Manager's name, then the user can carry on
filling in the rest of the form without having to enter the manager's
name.

No matter what I try, it just will not populate the Manager field!
Can anyone please help me with this, as I have just wasted an entire
day getting it working. I know its something to do with the fact it's
coming from a different table to what the form is based on, but for
the life of me I can't work out how to resolve this.

Much appreciated in advance,

Mario Sarno

Reply With Quote
  #2  
Old   
Ira Solomon
 
Posts: n/a

Default Re: Help setting form value using data from a second table - 01-16-2004 , 09:28 PM







Your combo box can deal with this, but it does require a line of code.
Set the combo box to have both fields. You can do this in the create
wizard. Make the manager field second. In the column width property
set the second width to 0". So only the first field will be seen.
In the events tab of the combo box goto on change andclick on the ...
and choose "code". Assume the combo box is named X.

you need one line of code:

me.manager = x.column(1).value

(or whatever the manager field is called).

you may need me.repaint, but I doubt it.

Good Luck
Ira Solomon





On 16 Jan 2004 08:11:24 -0800, mariosarno (AT) yahoo (DOT) co.uk (Mario Sarno)
wrote:

Quote:
Hi Guys,

I have a database that logs calls made by advisors in the Call Centre
where I work.

I have two tables:

tbl_Calls
tbl_Advisors

The tbl_Calls is where the details of the calls get stored, and has
the following fields, amongst others:

AccountName
Advisor
AdvisorManager
Comments
TimeOfCall

The tbl_Advisors table has the following fields (and is a linked table
from another database)

AdvisorName
TeamManager

I have created a form based on the tbl_Calls table where the call data
can be entered, and entering the data is fine, except for one snag....

I have a combo box on the form that links to the tbl_Advisors table,
and allows the user to select an advisor name without having to type
it in. I also have a textbox on the form that should contain the
manager's name, which again needs to be pulled in from the
tbl_Advisors table.

What I would like to happen, is when the user selects the Advisors'
name from the combo box, it will autopopulate the AdvisorManager field
with that advisor's Team Manager's name, then the user can carry on
filling in the rest of the form without having to enter the manager's
name.

No matter what I try, it just will not populate the Manager field!
Can anyone please help me with this, as I have just wasted an entire
day getting it working. I know its something to do with the fact it's
coming from a different table to what the form is based on, but for
the life of me I can't work out how to resolve this.

Much appreciated in advance,

Mario Sarno


Reply With Quote
  #3  
Old   
Mario Sarno
 
Posts: n/a

Default Re: Help setting form value using data from a second table - 01-18-2004 , 05:00 AM



Ira Solomon <isolomon (AT) solomonltd (DOT) com> wrote

Quote:
Your combo box can deal with this, but it does require a line of code.
Set the combo box to have both fields. You can do this in the create
wizard. Make the manager field second. In the column width property
set the second width to 0". So only the first field will be seen.
In the events tab of the combo box goto on change andclick on the ...
and choose "code". Assume the combo box is named X.

you need one line of code:

me.manager = x.column(1).value

(or whatever the manager field is called).

you may need me.repaint, but I doubt it.

Good Luck
Ira Solomon

Hi,

Many many thanks for that Ira, it worked like an absolute treat!!

Mario


Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.