473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

FORM QUESTION

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

Nov 13 '05 #1
10 1431
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
re******@pcdatasheet.com
www.pcdatasheet.com
<ra********@columbus.rr.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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

Nov 13 '05 #2

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!
Nov 13 '05 #3
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
re******@pcdatasheet.com
www.pcdatasheet.com
"Raymond Tackett" <ra********@columbus.rr.com> wrote in message
news:41**********@127.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!

Nov 13 '05 #4
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
re******@pcdatasheet.com
www.pcdatasheet.com
"Raymond Tackett" <ra********@columbus.rr.com> wrote in message
news:41**********@127.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!


Nov 13 '05 #5
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
re******@pcdatasheet.com
www.pcdatasheet.com
"Raymond Tackett" <ra********@columbus.rr.com> wrote in message
news:41**********@127.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!


Nov 13 '05 #6
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
re******@pcdatasheet.com
www.pcdatasheet.com
<ra********@columbus.rr.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
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
re******@pcdatasheet.com
www.pcdatasheet.com
"Raymond Tackett" <ra********@columbus.rr.com> wrote in message
news:41**********@127.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!



Nov 13 '05 #7
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.

Nov 13 '05 #8
Tom
Send it to my email address below.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
<ra********@columbus.rr.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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.

Nov 13 '05 #9
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!
Nov 13 '05 #10
No offense but did you read my last response? It said "Send it to my email
address below." Below means BELOW!! Look below in my signature line in my
response. Is that the way you followed my directions "perfectly" too?

Steve
PC Datasheet
"Raymond Tackett" <ra********@columbus.rr.com> wrote in message
news:41**********@127.0.0.1...
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!

Nov 13 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
3
by: Kaur | last post by:
Hi, I would appriceate any help to correct the code error that I am getting for the onclick event of a cmd button. I have two forms. Main Form "frmQuestion" and form 2 "SfrmQuestion"....
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
1
by: MrHelpMe | last post by:
Hello experts, I need a hand. On my asp submit page I have the following code: for i = 1 to 5 ' 5 question form' Question = Request.Form("Q" & i) Answer = Request.Form("A" & i) Comment ...
26
by: Jerim79 | last post by:
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when...
6
by: Greg Strong | last post by:
Hello All, Is is possible to use an ADO recordset to populate an unbound continuous Subform? I've done some Googling without much luck, so this maybe impossible, but let me try to explain...
6
by: smk17 | last post by:
I've spent the last few minutes searching for this question and I found an answer, but it wasn't quite what the client wanted. I have a simple online form where the user needs to fill out five...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.