dbTalk Databases Forums  

FORM QUESTION

comp.databases.ms-access comp.databases.ms-access


Discuss FORM QUESTION in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
raytackett@columbus.rr.com
 
Posts: n/a

Default FORM QUESTION - 01-05-2005 , 07:40 PM






I need to take information from a table, let's say one field is Agent
Name and the other field is Agent e-mail address. I need a combo box
with all of the agent names in there, and once I choose a name, the
correct e-mail address associated with that name goes into any control
that I may have on the form. I was able to write:
SELECT DISTINCTROW [Query1].[Agent Name],[Query1].[Agent E-mail] FROM
[Query1]; It shows me 2 columns, with the 2nd column bound it will
show me both of them, and once I click the name it will insert the
e-mail address. I need a little help.

Thanks in advance,

Raymond


Reply With Quote
  #2  
Old   
PC Datasheet
 
Posts: n/a

Default Re: FORM QUESTION - 01-05-2005 , 09:38 PM






The table should be:
TblAgent
AgentID
AgentName
AgentEmail

Your combobox should have the following properties:
Bound Column 1
Column Count 3
Column Widths 0;1.5;0

You then put the following code in the AfterUpdate event of the combobox:
Me!NameOfAgentEmailControl = Me!NameOfCombobox.Column(2)

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


<raytackett (AT) columbus (DOT) rr.com> wrote

Quote:
I need to take information from a table, let's say one field is Agent
Name and the other field is Agent e-mail address. I need a combo box
with all of the agent names in there, and once I choose a name, the
correct e-mail address associated with that name goes into any control
that I may have on the form. I was able to write:
SELECT DISTINCTROW [Query1].[Agent Name],[Query1].[Agent E-mail] FROM
[Query1]; It shows me 2 columns, with the 2nd column bound it will
show me both of them, and once I click the name it will insert the
e-mail address. I need a little help.

Thanks in advance,

Raymond




Reply With Quote
  #3  
Old   
Raymond Tackett
 
Posts: n/a

Default Re: FORM QUESTION - 01-06-2005 , 07:45 AM




Thanks for the response! I tried that and the only thing I did not
understand was what I needed to change in the table. Do I need to add
those fields with information in them? Are one of them just a primary
key? Do I leave the combo box looking at the query or do I create a
combo box and have it look at the table?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #4  
Old   
PC Datasheet
 
Posts: n/a

Default Re: FORM QUESTION - 01-06-2005 , 10:21 AM



The structure of your table needs to be the same as whay I show. If your
table does not have this structure, I suggest you change your table. You can
use your own table name and your own names for the fields. Your data then
needs to be in this table in the proper fields. Note that AgentID is the
primary key and is autonumber. For your combobox, you can either set the
rowsource property to the table or you can create a query and set the
rowsource property to the query. There would be two reasons for using a
query:
1. To limit which Agents can be selected by using some kind of query
2. To sort the agent names alphabetically
If you decide to use the query, be sure the query fields are in the same
order as the fields in the table. The instructions for setting the
properties for the combobox will then be the same as I provided for the
table. Finally, be sure to use the correct control names in the AfterUpdate
event.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


"Raymond Tackett" <raytackett (AT) columbus (DOT) rr.com> wrote

Quote:
Thanks for the response! I tried that and the only thing I did not
understand was what I needed to change in the table. Do I need to add
those fields with information in them? Are one of them just a primary
key? Do I leave the combo box looking at the query or do I create a
combo box and have it look at the table?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
  #5  
Old   
raytackett@columbus.rr.com
 
Posts: n/a

Default Re: FORM QUESTION - 01-06-2005 , 11:05 AM



Is there any way I could send you the database I have, and you could
look at what I have. Here is the way I started to do it. It works now
but I need it reversed. You may understand me better if you see it
like this.

I have 1 table called Badges with Fields named [Name] and [Badge]
I have another table called Table1 with 1 field named [Badge Number]

I created a form called Form1 from Table1
I drag over Badge Number
Changed it to a combo box as a value list with the values listed below
"106241";"106889";""243226";"951656"

I have a text box with the following information in the control source
=DLookUp("[Name]","Badges","[Badge] =" & [Forms]![Form1]![Badge
Number])

The table [Badges] looks like this:
Name Badge
Raymond 106241
David 106889
Jason 243226
Brian 951656

It will return the name if I select the value. I just want to switch
that where I select the name and it will return the badge number.


PC Datasheet wrote:
Quote:
The structure of your table needs to be the same as whay I show. If
your
table does not have this structure, I suggest you change your table.
You can
use your own table name and your own names for the fields. Your data
then
needs to be in this table in the proper fields. Note that AgentID is
the
primary key and is autonumber. For your combobox, you can either set
the
rowsource property to the table or you can create a query and set the
rowsource property to the query. There would be two reasons for using
a
query:
1. To limit which Agents can be selected by using some kind of query
2. To sort the agent names alphabetically
If you decide to use the query, be sure the query fields are in the
same
order as the fields in the table. The instructions for setting the
properties for the combobox will then be the same as I provided for
the
table. Finally, be sure to use the correct control names in the
AfterUpdate
event.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


"Raymond Tackett" <raytackett (AT) columbus (DOT) rr.com> wrote in message
news:41dd40f2$1_2 (AT) 127 (DOT) 0.0.1...

Thanks for the response! I tried that and the only thing I did not
understand was what I needed to change in the table. Do I need to
add
those fields with information in them? Are one of them just a
primary
key? Do I leave the combo box looking at the query or do I create
a
combo box and have it look at the table?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #6  
Old   
raytackett@columbus.rr.com
 
Posts: n/a

Default Re: FORM QUESTION - 01-06-2005 , 11:05 AM



Is there any way I could send you the database I have, and you could
look at what I have. Here is the way I started to do it. It works now
but I need it reversed. You may understand me better if you see it
like this.

I have 1 table called Badges with Fields named [Name] and [Badge]
I have another table called Table1 with 1 field named [Badge Number]

I created a form called Form1 from Table1
I drag over Badge Number
Changed it to a combo box as a value list with the values listed below
"106241";"106889";""243226";"951656"

I have a text box with the following information in the control source
=DLookUp("[Name]","Badges","[Badge] =" & [Forms]![Form1]![Badge
Number])

The table [Badges] looks like this:
Name Badge
Raymond 106241
David 106889
Jason 243226
Brian 951656

It will return the name if I select the value. I just want to switch
that where I select the name and it will return the badge number.


PC Datasheet wrote:
Quote:
The structure of your table needs to be the same as whay I show. If
your
table does not have this structure, I suggest you change your table.
You can
use your own table name and your own names for the fields. Your data
then
needs to be in this table in the proper fields. Note that AgentID is
the
primary key and is autonumber. For your combobox, you can either set
the
rowsource property to the table or you can create a query and set the
rowsource property to the query. There would be two reasons for using
a
query:
1. To limit which Agents can be selected by using some kind of query
2. To sort the agent names alphabetically
If you decide to use the query, be sure the query fields are in the
same
order as the fields in the table. The instructions for setting the
properties for the combobox will then be the same as I provided for
the
table. Finally, be sure to use the correct control names in the
AfterUpdate
event.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


"Raymond Tackett" <raytackett (AT) columbus (DOT) rr.com> wrote in message
news:41dd40f2$1_2 (AT) 127 (DOT) 0.0.1...

Thanks for the response! I tried that and the only thing I did not
understand was what I needed to change in the table. Do I need to
add
those fields with information in them? Are one of them just a
primary
key? Do I leave the combo box looking at the query or do I create
a
combo box and have it look at the table?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #7  
Old   
PC Datasheet
 
Posts: n/a

Default Re: FORM QUESTION - 01-06-2005 , 01:09 PM



Assuming each badge has a unique number, you don't need Table 1. Create an
unbound form (not associated with any table or query). Use the toolbox to
install a combobox and textbox on the form. Name the combobox BadgeName. Set
the Recordsource property of the combobox to your Badges table. Set the
following properties:
Bound Column 1
Column Count 2
Column Widths 1.5;0
Name the textbox BadgeNumber.
Put the following code in the AfterUpdate event of the combobox:
Me!BadgeNumber = Me!BadgeName.Column(1)

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


<raytackett (AT) columbus (DOT) rr.com> wrote

Quote:
Is there any way I could send you the database I have, and you could
look at what I have. Here is the way I started to do it. It works now
but I need it reversed. You may understand me better if you see it
like this.

I have 1 table called Badges with Fields named [Name] and [Badge]
I have another table called Table1 with 1 field named [Badge Number]

I created a form called Form1 from Table1
I drag over Badge Number
Changed it to a combo box as a value list with the values listed below
"106241";"106889";""243226";"951656"

I have a text box with the following information in the control source
=DLookUp("[Name]","Badges","[Badge] =" & [Forms]![Form1]![Badge
Number])

The table [Badges] looks like this:
Name Badge
Raymond 106241
David 106889
Jason 243226
Brian 951656

It will return the name if I select the value. I just want to switch
that where I select the name and it will return the badge number.


PC Datasheet wrote:
The structure of your table needs to be the same as whay I show. If
your
table does not have this structure, I suggest you change your table.
You can
use your own table name and your own names for the fields. Your data
then
needs to be in this table in the proper fields. Note that AgentID is
the
primary key and is autonumber. For your combobox, you can either set
the
rowsource property to the table or you can create a query and set the
rowsource property to the query. There would be two reasons for using
a
query:
1. To limit which Agents can be selected by using some kind of query
2. To sort the agent names alphabetically
If you decide to use the query, be sure the query fields are in the
same
order as the fields in the table. The instructions for setting the
properties for the combobox will then be the same as I provided for
the
table. Finally, be sure to use the correct control names in the
AfterUpdate
event.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


"Raymond Tackett" <raytackett (AT) columbus (DOT) rr.com> wrote in message
news:41dd40f2$1_2 (AT) 127 (DOT) 0.0.1...

Thanks for the response! I tried that and the only thing I did not
understand was what I needed to change in the table. Do I need to
add
those fields with information in them? Are one of them just a
primary
key? Do I leave the combo box looking at the query or do I create
a
combo box and have it look at the table?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!






Reply With Quote
  #8  
Old   
raytackett@columbus.rr.com
 
Posts: n/a

Default Re: FORM QUESTION - 01-06-2005 , 03:56 PM



I tried it that way and it does not work. Is there some place I could
post this database, so ANYONE COULD SEE WHAT I'M DOING? I appreciate
the help SO MUCH, and am following everything that is being said
perfectly.


Reply With Quote
  #9  
Old   
Tom
 
Posts: n/a

Default Re: FORM QUESTION - 01-06-2005 , 04:05 PM



Send it to my email address below.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource (AT) pcdatasheet (DOT) com
www.pcdatasheet.com


<raytackett (AT) columbus (DOT) rr.com> wrote

Quote:
I tried it that way and it does not work. Is there some place I could
post this database, so ANYONE COULD SEE WHAT I'M DOING? I appreciate
the help SO MUCH, and am following everything that is being said
perfectly.




Reply With Quote
  #10  
Old   
Raymond Tackett
 
Posts: n/a

Default Re: FORM QUESTION - 01-06-2005 , 09:00 PM



What is your e-mail address? I could not find it on the site. I think
I will have to send it to you on Sunday, unless I go into my company
tomorrow. It is on the drive there.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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.