Table Lookup Function

Mar 21, 2005

Hi,

I have a table with the following 3 fields (these are the ones i'm having the issue with but there are others).

ID, Country, City

The ID is an auto number.

The Country Field is a lookup with the following lookup properties

Display Control: Combo Box

Row Source Type: Value List

Row Source: "England";"Spain";"France" etc


:confused: Now the problem...

I also want a lookup in the City field which changes to reflect what was selected in the Country field.

E.G

If in the Country Field Spain is selected then in the City Field I should have the option of selecting Barcelona, Madrid, Valencia etc.

Is this possible in the lookup of a table???


Thanks. :)

View Replies


ADVERTISEMENT

Form Lookup Function

May 16, 2006

Hi there, please excuse my poor access skills, I've searched the forums but can't really find what I'm looking for......I have two basic tables in my db, one is an inventory listing all the stock in the company, and this is linked to a tracking table, which contains all the different movements for this stock item......this is a simple one to many relationship, what I want to do is lookup the value of the 'In/Out' field in the last tracking record for every item, and set the quantity of that item in the inventory table to 0 or 1 depending on the value......how would i best go about this and where should i put the code.....? Any help is much appreciated.

View 3 Replies View Related

Field Lookup Function (simple Probably)

Mar 22, 2005

I have a table with the following 4 fields (these are the ones i'm having the issue with but there are others).

ID, Country, City, Date

I enter data into this table via a form

The ID is an auto number. The date is simply enetered.

The Country Field is a lookup (in the table itself) with the following lookup properties

Display Control: Combo Box

Row Source Type: Value List

Row Source: "England";"Spain";"France" etc


Now the problem...

I also want a lookup in the City combobox (on the form) which changes to reflect what was selected in the Country field.

E.G

If in the Country Field Spain is selected then in the City Field I should have the option of selecting Barcelona, Madrid, Valencia etc.

I was told to use the following code in the afterupadate of "parent combobox":

Private Sub ComboCountry_AfterUpdate()
Select Case Me.ComboCity
Case "Test"
Me.ComboCity.RowSource = "A;B;C"
End Select
End Sub

Ive tried it but as always i get an error when i use the country drop down...

A pop up box with:

Compile error:
Method or data member not found

and visual basic opens with the top line of the code "Private Sub Country_AfterUpdate()" highlighted in yellow, and the ".RowSource =" is highlighted in blue.

These are the properties of my form

My Country Combobox is called - "Country"
My City Combobox is called - "City"

I have put the above code in the after update of the "Country" combobox as below:

Private Sub Country_AfterUpdate()
Select Case Me.City
Case "England"
Me.City.RowSource = "London;Manchester;Leeds"
End Select
End Sub


Anyone know where the error in the code is? Obviously i have reduced the code to include only one case.

Attached is the DB

View 3 Replies View Related

Lookup Function In Simple Query

Aug 30, 2004

Hi there

I have created a simple query to subtract field B from field A and store this value in field C, however now I need the query to lookup the value from field C in the previous record and store it in field D in the current record. I'd appreciate your HELP

Regards

Boertjie

View 3 Replies View Related

Modules & VBA :: Lookup Function To Use In Multiple Queries

Jul 24, 2015

I have a database with various tables containing information about students, timetabling, assignment submission dates and multiple tables with grades for various assessments. All grades are held as percentages.

In a large number of different queries / reports I want to output the grade as an item from verbose scale with 17 points (excellent first, high first etc.). I've set up a table called 17pointscale which contains fields called 17pointscale (with the verbose names), lowerlimit (number) and upperlimit (number).

I have a query in SQL (which works) to take the percentage grade from one of my grade tables AssessedWorkGrades.Grade and return the text on the 17 point scale.

SELECT AssessedWorkGrades.Grade, [17PointScale].[17PointScale]
FROM AssessedWorkGrades LEFT JOIN 17PointScale ON ([AssessedWorkGrades].[Grade]
>= [17PointScale].[LowerLimit]) AND ([AssessedWorkGrades].[Grade] <= [17PointScale].[UpperLimit]);

Is there any way of converting the SQL to a custom vba function which would enable me to use this as a lookup in a large number of queries.

I think that it should be possible to set up a function called ScaleGrade and in any query Expression: ScaleGrade(XXX) will take XXX and return the 17 point scale.

I think that AssessedWorkGrades.Grade needs to be replaced by a variable that is inputted on use of the function but am not sure how to accomplish this.

View 1 Replies View Related

Modules & VBA :: Restrict Value In Lookup Field To Only Include Values From Table B Not In Table A?

Feb 2, 2014

I have a database that has 2 tables. Table A and Table B. Table A is my primary table. On this table I have 2 fields. The first field is a LOOKUP Field that looks up information from Table B and displays my selection in the field on Table A. Then using DLOOKUP I automatically input the information in the Second Field on Table A based upon the selection from the First Field.

This is working mostly correctly. However, the problem is, when I click on the next record in the table, it automatically changes the Second Field on that record to the same value as the record before it and continues this trend each time I click on another record. This occurs without me making a selection in the first field. If I make a selection in the first field it does change the Second Field to the Correct Value, but then the next Record has the same issue.

How do I go about fixing this so it doesn't change the value with the change of the record. Only change if I change that particular field within that 1 record?is there a way to restrict the Value's in my lookup field to only include the Values from Table B that aren't already in Table A?

View 5 Replies View Related

Tables :: Two Fields In A Table / Link To Same Lookup Table

Mar 14, 2013

I have a table "Product" and in this table I have two fields "StoragePlaceID1" and "StoragePlaceID2". Both these fields link to the look-up table "StoragePlace"

*Attached Image "Product_StoragePlace" from the Access Relationship Window"*

When I want to add a new Product from my inter face i get the error you can see in the Attached Image "Save_Error".I think the problem is that the Relationship is defined as One-to-Many,there a way to define the relationship as Zero-to-Many.

View 5 Replies View Related

Table Lookup - Row Source From Another Table - Only Showing Numbers

Feb 11, 2012

When I have a 3rd table looking at the row source of the 2nd table, which is looking at the row source of the 1st table. I only get numbers.

Everything I have read so far points to using a query as a solution. However, the query I made is not updating the information from the 2nd table.

I have attached a few examples.

Attachment 6247

this below shows. I changed "Bakersfield-test1" in the original table. However, the query I made does not update, still showing "Bakersfield-test". When you click on the drop down, it shows the updated "Bakersfield-test1", but it does not repopulate my column with the updated info from the table.

Attachment 6248

View 4 Replies View Related

Need 2 Fields From Table 1 / Using Lookup Info From Table 2 And Put Into Table 3

Jun 28, 2013

I need to get x and y coordinates for each device, but the data has to get looked up from 2 other tables.

I have a table (called InstReclosers) that has device names. Each device is on a Section. I can go to another table (called InstSections) and look up what Node that particular section is tied to. Then I need to go to another table (called Nodes) to get the X and Y location for that particular node.

How I can go about getting this X and Y data into the InstReclosers table?

...in summary, InstReclosers has device name and section name. InstSections has section name and node name. Nodes has node name and XY coords. Need XY coords for each device in InstReclosers.

View 3 Replies View Related

Lookup Table

Jan 6, 2006

I am very new to Access and any help would be appreciated. I have been through the entire Access Bible and many forums but can't find the answer to my specific question.

The project:

I'm setting up a database for tutors and students. Tutors will, via the web, enter data about a specific tutoring session (studentName, subject, sessionLength, etc.) Then at the end of the month a report will be generated detailing hours tutored and total compensation.

The problem:

Students pay varying rates based on subject (math or verbal). So in the Session table each record for each tutoring session has an empty field called payRate. This is the rate the student will pay based on subject. So I need this field to "fill in" automatically based on the 'student' and the 'subject' from the same record. Then I can multiply the field by sessionLength and get a totalPay field for the session. Add these at month's end and pay the tutors.

I've set up a lookup table called 'subject' with three fields (student,subject, payRate) and I have the student and subject combined as the primary key. Am I on the right track here? If so, how do I link the tables to get that Session 'payRate' field to fill in automatically. This is where is breaks down for me. I've tried the lookup wizard but all I seem to get when I open the Session table is an empty PayRate field with a drop down box containing the entire subject lookup table.

Sorry for being so long winded but I need help from someone better at his than me. Thanks in advance.

View 6 Replies View Related

How To Use A Lookup Table

Apr 24, 2015

My experience has been with SQL Server using Delphi and other languages where code is written for data integrity. A local service club has asked me to setup a relatively simple Access database where those that will use it have very little experience. I am not sure how to setup the following: The ClientTbl has a field, Ad. There is a table, AdTble with the following fields:

Primary key: AutoIncrementing
Description: text (30)
Amount: integer (dollar)

I would like to have a dropdown that shows the description, and when selected, the link to the Primary Key is inserted in the field, Ad. Can this be done? Will the Amount show?

View 1 Replies View Related

LookUp Tables For Dynamic Set Of Attributes: Set A Pointer Or Use A Generic LookUp?

Jul 24, 2007

I'm wrestling with the issues; in other threads, it became apparent that because I could not know ahead of time what I will need to know about a given entity, I will use a table to enumerate attributes that is applicable for a given entity.

However, the stumper is that what if an attribute should conform to a set list of values? Since they are dynamic, I would have problem predicting what I will need to be able to lookup, and am even don't know whether I will need a one-many lookup or many-many lookup.

I thought that generic lookup table with a table listing "classes" of lookup would allow me to have one big generic lookup table while using "classes" to act like virtual tables so I can then set the query to appropriate "class" to return just right set of values.

But as I thought about it, I ran into some issues which is pulling me toward the crazy idea that I should have freestanding tables, and use a field in tblAttribute to give me the table's name so I'd know which free-standing table it points to, and have the necessary key to lookup the values within that table.

Even though my gut instincts tell me that I shouldn't be going against the conventions of database design (who the frick goes around creating free-standing lookups?!?), I'm simply not sure how I can use a generic lookup table to hold all information.

For example, suppose I was given a list of values that has its own categories. Since the former design allows only for two level (lookup and lookupclass), where am I to insert that extra level?

Furthermore, I found myself needing a set of virtual keys to reference a certain "class" of lookups for report purposes. That means I need an extra field in my lookup table than I originally anticipates. What if I find myself needing one more field that just won't fit the generic lookup table?

So does anyone have suggestions on how we would create a placeholder for a lookup table that will be made just in time?

View 4 Replies View Related

Field & Lookup Table

Jan 6, 2006

I am very new to Access and any help would be appreciated. I have been through the entire Access Bible and many forums but can't find the answer to my specific question.

The project:

I'm setting up a database for tutors and students. Tutors will, via the web, enter data about a specific tutoring session (studentName, subject, sessionLength, etc.) Then at the end of the month a report will be generated detailing hours tutored and total compensation.

The problem:

Students pay varying rates based on subject (math or verbal). So in the Session table each record for each tutoring session has an empty field called payRate. This is the rate the student will pay based on subject. So I need this field to "fill in" automatically based on the 'student' and the 'subject' from the same record. Then I can multiply the field by sessionLength and get a totalPay field for the session. Add these at month's end and pay the tutors.

I've set up a lookup table called 'subject' with three fields (student,subject, payRate) and I have the student and subject combined as the primary key. Am I on the right track here? If so, how do I link the tables to get that Session 'payRate' field to fill in automatically. This is where is breaks down for me. I've tried the lookup wizard but all I seem to get when I open the Session table is an empty PayRate field with a drop down box containing the entire subject lookup table.

Sorry for being so long winded but I need help from someone better at his than me. Thanks in advance.

View 2 Replies View Related

Lookup Table - Numbers?

Mar 9, 2006

Hi all,
I Have a question regarding lookup tables. I have a table called tblActivities. In this, I have created a field called ActivityBudget. I would like this to be a lookup field (select entries from a list). In order to do this, I have created a table called tblBudgetLists with all the various budgets. For the AcitvityBudget field in tblActivities, I have set it as Text with the following things:

Display Control: Combo Box
Row Source Type: Table/Query
Row Source: tblBudgetLists
Limit To List: Yes

The function is half working... There are 19 entries in the tblBudgetLists table. When I select a budget from the list in tblActivities.ActivityBudget, the numbers 1 to 19 are displayed (I am assuming because there are 19 entries), rather than the names of the budgets. Any ideas on how to change this?

sugar05

View 1 Replies View Related

If A AND B Then C Lookup Table Needed

Oct 30, 2006

I am looking to set up tables in such a way that will allow for the concept:
If Variable 1=A and Variable 2=B then Output of 3=C

For Example:
If the House is "Blue"
And the Man drinks "Beer"
Then his pet is a "Dog"

If the House is "Green"
And the Man drinks "Vodka"
Then his pet is a "Bird"

NOTE:
There is no equational relationship between the first two variables to get the 3rd output. It is simply a lookup table. In excel you would have the color house down the left, the drink across the top and in the cells would be the type of pet. But I am struggling with how this can be made to function within Access since I will want the user to obviously be able to pick the first two variables and have the "answer" spit out.

View 2 Replies View Related

Lookup Table Confusion

Nov 21, 2007

Hi everybody

I have been unsure about this topic and want to finally be sure.

When I create a lookup table I don't include a PK; I just have the one field. Therefore I don't include an FK within the Main table; I include the same field name as the field name in the lookup. "sector Details" in lookup and "sector Details" in Main.

Am I better to make up these lookup tables and use a PK and then have the FK within the Main Table? Is this easier or trickier to work with? And will it cause any problems if I did include keys? for example, providing combo boxes as search criteira for forms using the FK/PK as bound fields?

I know it's a bad idea to have lookup fields in tables which I'll avoid. But this means if I'm updating in the back end I'll only see a table full of keys and not the field name!

Hope someone can help because I've been getting different advice since I started on Access including Professional books using lookup fields.

Thanks.

View 8 Replies View Related

Lookup Table Value Must Be Populated

Feb 19, 2008

I have a table called tbl_workorders. One of the fields on this table is optional but because the lookup table is on the one side of a 1-to-many relationship using an auto-number key it is requiring that this field be populated to create a record on the workorder table. This is a problem because the field is optional.

tbl_workorders
WorkOrrderID(PK)
Field1
Field2
Field3
Field4
JobSubtypeID (FK-many) <---- Lookup field


tbl_Subtypes
JobSubtypeID (PK-one)
SubtypeDesc


Should I set the SubtypeDesc field to a default value of "none"? I know this is storing unnecessary data, but is there another option?

View 13 Replies View Related

Adding Iif Or Maybe A Lookup Table To Db

Mar 15, 2006

Hello folks first post here. I tried reading through the boards to find someone with a similiar question, but not luck yet. I have been working with a basics of Access for about a year. I did take take a bit of programming in college but I don't remember much of it, so I looking for a little help. I can usually Google for answers but I cannot seem to find the write key words this time.

A while back I created a table that tracks employees' data and recently I started working with the insurance data I have gathering for sometime.

It goes something like

Field Name Data Type

SS# Number (primary key)
Insurance $ Number
PPO YES/NO
HMO YES/NO
Self YES/NO
Spouse YESNO
Children YES/NO
Family YES/NO
Dental Self YES/NO
Dental Spouse.......etc.


What I'm trying to do is turn the yes/no's into total dollars for each person. I have done this in Excel but the fields were differnet and I had to use a many, many if.'s or a lookup table(data array)

PPO doesn't = a dollar amount by itself, but PPO + Self = $19.03 or PPO + Self + Dental Self = $23.00. Or the person can just have Dental Spouse = 8.86. Pretty much the people can take a piece and leave another.

"Insurance $" is another field name and is where I am trying to get the total to go.

I was thinking of a lookup table but I don't know how to do that in outside of Excel.

I am thankful for any help or even a nudge in the right direction.

~Profector

View 6 Replies View Related

Lookup Values In Another Table

Jun 13, 2006

BACKGROUND

I am desperate to solve this problem but unfortunately I have not been able to figure it out. Below I will outline a design of a database and the desired results.

I know what I want to do but I don’t know how to do it (or whether it is impossible!)

DATABASE DESIGN

The design below is a simplified version of the real thing but it contains the essential information needed to understand my database.

Staff Data
Contains daily data for several members of staff
Staff ID
Staff Name
Date
Data Field 1
Example records:
600-001, Bob Smith, 01/03/2006, 50
600-001, Bob Smith, 02/03/2006, 50
600-001, Bob Smith, 03/03/2006, 50
600-001, Bob Smith, 04/03/2006, 50
600-001, Bob Smith, 05/03/2006, 50
600-002, Jayne Cole, 01/03/2006, 60
600-002, Jayne Cole, 02/03/2006, 60
600-002, Jayne Cole, 03/03/2006, 60
600-002, Jayne Cole, 04/03/2006, 60
600-002, Jayne Cole, 05/03/2006, 60
600-003, Alex Winter, 01/03/2006, 20
600-003, Alex Winter, 02/03/2006, 20
600-003, Alex Winter, 03/03/2006, 20
600-003, Alex Winter, 04/03/2006, 20
600-003, Alex Winter, 05/03/2006, 20

Team Lookup
Shows what team each staff member belongs to and what date this is effective.
Staff ID
Team
Start Date

Example records:
600-001, Sales, 01/01/06
600-002, Sales, 01/01/06
600-003, Accounts, 01/01/06
600-002, Accounts, 04/03/06

Please note:

The first three records show that at the start of the year Bob (600-001) and Jayne (600-002) worked for Sales and that Alex (600-003) worked for Accounts.

The last record shows that from 04/03/06 Jayne switched teams to Accounts

Query Assign Team
Assigns the correct team to Staff ID for each date
Staff ID
Staff Name
Team
Date
Data Field 1
Desired Results:
600-001, Bob Smith, Sales, 01/03/2006, 50
600-001, Bob Smith, Sales, 02/03/2006, 50
600-001, Bob Smith, Sales, 03/03/2006, 50
600-001, Bob Smith, Sales, 04/03/2006, 50
600-001, Bob Smith, Sales, 05/03/2006, 50
600-002, Jayne Cole, Sales, 01/03/2006, 60
600-002, Jayne Cole, Sales, 02/03/2006, 60
600-002, Jayne Cole, Sales, 03/03/2006, 60
600-002, Jayne Cole, Accounts, 04/03/2006, 60
600-002, Jayne Cole, Accounts, 05/03/2006, 60
600-003, Alex Winter, Accounts, 01/03/2006, 20
600-003, Alex Winter, Accounts, 02/03/2006, 20
600-003, Alex Winter, Accounts, 03/03/2006, 20
600-003, Alex Winter, Accounts, 04/03/2006, 20
600-003, Alex Winter, Accounts, 05/03/2006, 20

Query Group By Team
Summarises data by team/date
Team – Group By
Date – Group By
Data Field 1 - Sum
Desired Results:
Sales, 01/03/06, 110
Sales, 02/03/06, 110
Sales, 03/03/06, 110
Sales, 04/03/06, 50
Sales, 05/03/06, 50
Accounts, 01/03/06, 20
Accounts, 02/03/06, 20
Accounts, 03/03/06, 20
Accounts, 04/03/06, 80
Accounts, 05/03/06, 80

PROBLEM: WHAT I AM TRYING TO DO

I don’t know how to get the query “Query Assign Team” to work!!

I would like to lookup up the ‘Staff ID’ and ‘Date’ in “Team Lookup” and return the appropriate value for ‘Team’

If the only two records in Tbl Staff data were:

600-002, Jayne Cole, 03/03/2006, 60
600-002, Jayne Cole, 04/03/2006, 60

I want the query to return:

600-002, Jayne Cole, Sales, 03/03/2006, 60
600-002, Jayne Cole, Accounts, 04/03/2006, 60

Can anybody help me?

Should I be using DLOOKUP? If so, how?
Is VBA the only way around my problem? If so, can you tell me what it is?
Am I attempting the impossible?

View 9 Replies View Related

Need Help With Lookup On Table/form

Apr 22, 2005

I have a contact dB with 2 contacts (main & alternate). I would like to be able to pull any record containing either the main or alt last name up. Right now the unbound combo box works fine pulling up the first contact name but I need to be able to pull up a record if the second contact name matches as well. I am trying to use 1 unbound combo box to look at both fields (LastName1 & LastName2). Is it possible and how should I set it up?

View 14 Replies View Related

Lookup / Edit Table

Sep 26, 2005

Hi all,

I am trying to learn Access form building by creating a training database. I created a form that has all of my class information and the students who are attending the class as show in the attached jpg.

If a student has already attended a previous class I don't want to enter his information again. I want to do a lookup for the student and if the student does not exist then create a new student. Is there a way of doing this without coding?

Thanks Steve

View 2 Replies View Related

Lookup Or Separate Table?

Aug 19, 2004

While trying to "normalize" a developing database, a question has come up. I have two sets of information that will probably never change. Hair color and Eye color. Should these be put into a separate table or can I include those two fields in the table containing information about the person and then use the lookup wizard function in the table design and "type in the values I want"? I am using '97. Thanks.

View 1 Replies View Related

How To Lookup Values In A Table And Add Them To Another?

Jan 22, 2007

I just started a new database and I'm new at this so I have a question about ID numbers for my two tables.

In Table1, I have faculty demographic information, and a FacultyID (unique ID number created by AutoNumber).

Table2 has the courses those faculty members taught - one faculty teaches many courses. But this table does not have the FacultyID that I added to Table1.

So, how do I automate the process of looking up the FacultyID number from Table1 and adding it to the currently blank FacultyID field in Table2? Theres hundreds of records and this will be done every semester, so I need an automatic way of doing this lookup.

Any help would be appreciated. Thanks.

View 1 Replies View Related

Default Value Lookup From Same Table

Feb 15, 2007

I'm using Access 2003 to write reference books. I have a field labeled Title Page and one labeled Source Page. 9 times out of 10 the Title page is the same as the source page. So, how can I put in a default value that the source page is the same as the title page, but then I'm allowed to go in and change the source page in the rare instance when they don't match. I'm fairly new to Access, though not to database programs.

View 2 Replies View Related

Lookup Field In A Table

Jan 12, 2008

hi, plz i need a fast help
i have 3 tables in access:
Country Table: fields:country Id, country name

City Table: fields: City ID,Country Name(lookup field to Country Table), City Name

Street Table: fields: Street Id, country name(lookup field to Country Table), City Name(must be lookup to City Table where City.Country name = Street. Country name), street name

my question is: how can i make the lookup of the City Name in the Street Table, in a way that only cities of the specific country of the record active are displayed ???
example:
Country table:
1 Lebanon
2 KSA
3 Kuwait

City Table:
1 KSA jeddah
2 KSA Riyadh
3 Lebanon Beirut
4 Lebanon Tripoli

STreet Table:
1 KSA (???) Sary (the ?? must be a combo Box that show only the cities of KSA: jeddah, Riyadh..which are in the City Table)
2 KSA (???) sondos (same as above)
3 Lebanon (???) hamra (the ??? must be a combo box that show only the cities of lebanon: Beirut and tripoli...which are in the city Table)

i have created all the fields in these tables...and when i put the field City Name as lookup, i am failing to mak eit read correctly from the city table according the the country of my active record..
plz anybody knows how to do this query???

View 2 Replies View Related

Forms :: Lookup A Value In Another Table?

Oct 8, 2013

on a subform i want to lookup a value in another table (which I do using a combo box) then i want it to auto fill in the description in a txt box, and save that information in another table.

How to do?

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved