473,765 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Lookups and Display in Forms

I'm back in the Access development mode and seem to have forgotten how to do
2 things that should be simple. I have a database with a table of contacts,
companies and activities. The idea is that I'll put in a list of companies,
a bunch of contacts that work at each company, and an activities form that
allows me to input every activity I do for each contact.

The activities table includes a lookup field (also named contactID) for
contactID field in the contact table so that each activity is assigned to
only one contact by selecting the contact's contactID. In the contacts table
I have done the same with the companyID so that each contact is assigned a
company by using the companyID. The lookup allows me to see the contact name
in the first example and the company name in the second example so that
selection is easy. Here's what I wanted to do in the activities form:

1) I have a lookup table for the contactID which looks up the contact's name
in the contact table so that "firstname, middlename, lastname" appears in
the dropdown insead of just the contactID number. Unfortunately 2 things
occur: (a) I see the firstname, middlename, lastname fields but I want them
sorted by the lastname field -- it sorts by firstname; (b) when I finish
using the dropdown, all I see is the firstname field and the other two
disappear. I'd like to have all 3 fields appear.

2) I'd like to have a field which merely displays the companyname field from
the company table on this form. Since I have selected a contactID, I have a
companyID lookup in the contact table. I'm not sure how to set up this query
and a field that shows the results of the query in the form. Obviously this
does not have to be stored because it already has been stored and it is used
just for dispay purposes only...

Thanks all so much in advance...

Marc
Nov 12 '05 #1
2 4445
First off, lookups are AWFUL...
use a combobox, columncount = 2. widths 0;1 rowsource: "SELECT
Firstname & " " & MiddleName & " " & LastName FROM tblContacts ORDER
BY LastName;"...

Or better... "SELECT LastName & ', '& FirstName & ' '& MiddleName As
CustName
FROM Contacts ORDER BY LastName, FirstName, MiddleName;"


2) I'd like to have a field which merely displays the companyname field from
the company table on this form. Since I have selected a contactID, I have a
companyID lookup in the contact table. I'm not sure how to set up this query
and a field that shows the results of the query in the form. Obviously this
does not have to be stored because it already has been stored and it is used
just for dispay purposes only...


if you have this in a combobox, you could include the company name in
the combobox's rowsource:

"SELECT ContactID, ContactName, Company.."
then have 3 columns, with column(0) and Column(2) having zero width.
Then you could set your company textbox's rowsource =
cboContact.Colu mn(2) and it would show up...
Nov 12 '05 #2
> 1) I have a lookup table for the contactID which looks up the contact's
name
in the contact table so that "firstname, middlename, lastname" appears in
the dropdown insead of just the contactID number. Unfortunately 2 things
occur: (a) I see the firstname, middlename, lastname fields but I want them sorted by the lastname field -- it sorts by firstname; (b) when I finish
using the dropdown, all I see is the firstname field and the other two
disappear. I'd like to have all 3 fields appear.
Since the combo box is based on a query, then simply bring up the combo box,
click on the sql data source, and set the sort for last name to be
descending. You should probably thus make the combo box have CntactId,
LastName, middle, First. (Make whatever field you want to search by the 2nd
field to the contact id). Once the user selects the name, then contactId is
set. You can either display Middle, first etc by placing additional text
boxes on the screen, and using dlookup's as the source for each text box.
However, that is a bit messy, so you can consider basing the form on a sql
that joins in those additonal fields. Even more cool is to consider using a
sub-form. I explain how to do this at:
http://www.attcanada.net/%7ekallal.m...000000005.html
2) I'd like to have a field which merely displays the companyname field from the company table on this form. Since I have selected a contactID, I have a companyID lookup in the contact table. I'm not sure how to set up this query and a field that shows the results of the query in the form.


Yes, this would be double lookup. So, yea, I would use my sub-form idea, and
build a query that displays the contactId, Contact Name, and Contact
Company. You then base the sub-form on this query and you thus get to
display all the contact info, and you ONLY need to supply the contactId in
you main form to display all of this stuff! (use the link master/child in
the sub-form based on contactId).

--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
No************@ msn.com
http://www.attcanada.net/~kallal.msn

Nov 12 '05 #3

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

Similar topics

0
6268
by: mdh | last post by:
I am trying to learn the basics of MVC applications using a Tomcat infrastructure. I'm starting by building a simple application with: * a login.jsp page for a basic login form with a action pointing to "loginValidate.jsp" * a loginValidate.jsp page that references logic to validate requests * a loginBean class used to pass info between the JSP and validation logic * a usersDAO class used to perform lookups in a USERS
10
13459
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group related to checkboxes. Thanks!!!
3
1981
by: Pete | last post by:
I'm currently doing a database that uses comboboxes to look up records in other tables, whether they be lookup tables or otherwise. When a user needs to add an item to one of these tables, the user has to either double-click on the combobox or go to the appropriate form via an item on the main menu. So, using an example, if someone is entering enrollment information, they would definitely need a student and a course. If the course has...
1
2152
by: c.verma | last post by:
I am not able to hide a href element using javascript. Here is my code written on aspx page. On the click of "OK" button, I want to hide href element. But I am getting message: Object required. Any ideas? <asp:textbox id="txtWait" style="DISPLAY: none" runat="server" Width="326px" BorderStyle="None" BorderColor="whitesmoke" ForeColor="Red" ReadOnly="true" Font-Bold="True">Please wait while we process your information...</asp:textbox><br>
4
2087
by: Regnab | last post by:
I've got a form - "frmLookup" (with a subform) that works very happily on its own. The form has a list box, which when updated requeries the subform to display the appropriate results. The problem is that for the final user interface, I had planned to use a "frmDisplay" form which had a number of menu items and then depending on what the user selected, it would display the appropraite form in a subform beneath the menu items. I did this...
2
2902
by: King Ron | last post by:
Ola all. In responding to a recent post requesting help with a search issue, I recommended using a combo box lookup in the table design. "paii, Ron" (no relation) posted this reply: " There are many posts in this group explaining the pitfalls of using the lookup feature in tables. Best practice appears to be, keep the lookup in the forms using combo box or list box."
2
3173
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if i change something in php file using in ajax function.it not refreshed,means its shows the previous result it not get updated.i can't understand whats the prob.this is the code i m using: <? include("config.inc.php"); //error_reporting(0); ...
0
183
by: David | last post by:
Hi Vlasta. I had a look at your original mail. I think your simpler (than XML) format is a good idea for now. At a later stage you could change it to something like this: <CUSTOM_TAG KC=12 KNJ=13 VCC=0...etc>text goes here, some more text</CUSTOM_TAG> <CUSTOM_TAG KC=13 KNJ=14 VCC=1...etc>text goes here, some more text</CUSTOM_TAG>
6
1377
by: KEV999 | last post by:
I have a table ADDRESSPOINTS with fields ADDRESS, X and Y. This contains thousands of existing records of addresses and their associated X and Y mapping coordinates. I have a table INCIDENTRECORDS with fields INCNUMBER and NAME. I want to be able to create records in the table INCIDENTRECORDS via a form INCFORM by selecting from the appropriate pre-listed addresses and then entering data in the fields INCNUMBER AND NAME. I then want a query...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9955
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9833
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7378
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.