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 Replies


ADVERTISEMENT

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

Tables :: Lookup Field Using Another Multi Value Lookup Field As Data Source

Nov 23, 2012

how to do a particular thing in Access 2010 (I don't even know if it is possible).

I have a table named PRODUCTS:
ID_PRODUCT (primary key, autonumber long integer)
ALLOWED_OPTIONS (multi value text lookup field: "Option 1";"Option 2";...;"Option 9")

So I can store, for each different product, none, one, or more options to let the customers choose from.

I have a table named ORDERS:
ID_ORDER (primary key, autonumber long integer)
FK_CUSTOMER (foreign key, linked to the primary key of a CUSTOMERS table; represents the customer that places the order.)
FK_PRODUCT (foreign key, linked to PRODUCTS.ID_PRODUCT; represents the product that the customer has choosen)
CHOOSEN_OPTION (lookup text field; the customer must choose ONE option among those allowed for the product he has ordered)

The problem is that I would like the CHOOSEN_OPTION field to show as a combobox, listing the values stored into PRODUCTS.ALLOWED_OPTIONS, so that when a customer buys a product, he can choose only among the options allowed by that particular product.How can I manage a multi value field to populate a combobox, in which every item stays on its line? If I use, as a query to populate the combobox:

select [PRODUCTS].[ALLOWED_OPTIONS]
from PRODUCTS
where [PRODUCTS].[ID_PRODUCT]=[FK_PRODUCT]

I obtain an empty combobox.If I refer to the last field as [ORDERS].[FK_PRODUCT], Access asks me to type a value for "[ORDERS].[FK_PRODUCT]", treating it as an unknown parameter.I think that the problem is that when the combobox expands, the record is not committed yet, so FK_PRODUCT is unknown (NULL?). But this happens even if I commit the record typing something in FK_PRODUCT and then I re-enter the record and I expand the CHOOSEN_OPTION combobox, that is still empy although FK_PRODUCT exists, now.Is there a particular syntax to refer to a field in a record not committed yet (something like "THIS." or "ME.")?

View 5 Replies View Related

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 4 Replies View Related

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

Simple Question About NZ Function

Apr 21, 2008

I have a simple query and I am trying to total the value for the the quarter. Some of the months don't have a value so I used the NZ function IE April: NZ([Apr], 0). This put a zero value in each field so it could be added together. My Total field will only total the values if there is a entered value in each field. Example

Apr May Jun Q1
1 2 3 6 - GOOD
0 0 4 No Value - Bad

Can someone help me with this? Thanks

Brennan

View 1 Replies View Related

Simple Question Re SUM Function With Condition

Jan 18, 2005

Hello

I've got a form with fields for projects, type of time (normal time/overtime) and hours.

the fields are cboProjects, cboTimeType and Hrs respectively (simplified for this forum)

I have a tbo in the footer, and I want it to sum all the hours entered where the type time is normal time. So I tried putting in the following expression into the Control Source of the control for tboHrsSum as follows:

=Sum([Hrs]) WHERE [cboTimeType]=1

1 is the ID of Normal Time.

This doesn't work though - can anyone tell me what I'm doing wrong?

Thanks

View 5 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

Rowsource Of Lookup Field Dependent On Field Value In Same Record In Subform

Jul 6, 2014

I want to create a different rowsource-query for a lookup field (field1) in each record in a subform. The rowsource changes dependent on the value in another field (field2) in the same record. How can this be done?

- I tried to change the rowsource-query in an eventmacro when the focus is set to field1, but this ofcourse changes the rowsource for all field1's and makes the allready selected values unvisible.
- I think I have to include the value of record 'field2' in the rowsource query, but i cannot find a way to include that value in the query.

Something like:

Lookup field1 in the subform contains this rowsource
- SELECT CUSTOMER.Id, CUSTOMER.AGE, CUSTOMER.NAME
FROM CUSTOMERS
WHERE (CUSTOMER.AGE= me![field2]);
me![field2] however does not function

View 5 Replies View Related

Lookup 2 Field To Auto Fill Another Field?

Dec 30, 2012

Is it possible to look up 2 field to auto fill another field?

Field 1 is "Exposure" this autofill with "Probability" is user input.

I need to lookup Exposure and Probability and autofill a score in to "Risk Rating". This to stop incorrect data being inputted.

I have a table with all the results combination in it.

Would it be possible to use a Dlookup to look at Exposure and Probability to give me the score

I tried a Combox with autofill. But the power to be would like it done without user input.

View 11 Replies View Related

Lookup Field

Jan 11, 2008

Hi,

my only other issue!!! i have a lookup field on a table and when i view it in datasheet, i can see the actual lookup value i need however i have tried the following options:
create a form from the table
added a combo box to an existing form and gone through the wizard

both options show the id number and NOT the value i need to show. what can i do to show my actual information?

many thanks,

NS

View 8 Replies View Related

Using The Lookup Field...

May 3, 2005

Let's say that I have two tables:

Table Numbers:

ID VALUE
-- ------
1 123
2 456
3 789

Table Letters

ID VALUE NUM_LOOKUP
-- ------ -------------
1 ABC 1
2 DEF 3

Now, I'd like to use the lookup feature so that NUM_LOOKUP is a combo that displays the data in VALUE based on the relationship between ID in the two tables.

So, when you open the Letters table, you see the above. If you click in the NUM_LOOKUP field, you get a box that displays "123" for the first record and "789" for the second record.

I'm very close -- Here's what I have:

I tried the following:
Display Control: Combo Box
Row Source Type: Table/Query
Row Source: SELECT [ID],[VALUE] FROM [Numbers] AS [NUM_LOOKUP];
Bound Column: 1
Column Count: 2

Problem: This selects ALL values of ID from [Numbers].

I tried adding the following to my row source:
WHERE [Letters].[NUM_LOOKUP]=[Numbers].[ID]

This just gives me the "enter parameter" dialog box for [NUM_LOOKUP] and [ID].

Any help?

Thanks!

View 2 Replies View Related

Lookup Field

Jul 31, 2006

Alright, I have a field called metrics that looks up the text in another table caled Metric Name. I want to delete the table that is being used to supply the values, but I still want a listbox with all those names. Also I want to be able to add names to that listbox. I am not sure how to do this.

View 3 Replies View Related

Help With Lookup Field

Dec 11, 2006

Hi all,

It is along since i have used access for anything and I am having problmes getting it to do what i want it to do.

I have 2 tables one which hold the data needed and the other is being used to hold a list of products with prices.

In my main talbe in which the data will be entered into I have a drop down so the product can be selected, once it is selcted i want the next field filled in automaticaly with the price. The look up looks at my products table which hold the price too. I tried with setting the look up based on a query but it get errors about using the same table

Anyone help me???

Thankyou for looking

View 11 Replies View Related

Lookup Field

Sep 25, 2006

I would like to create a lookup for a field - I want to display 2 columns, but store only one in the table.

Id City
1 Sheboygan
2 Sheboygan Falls
3 Plymouth


Show both fields in the lookup, but only store the Id in the table.

I can't seem to get the second column to display.

View 5 Replies View Related

Lookup Field Value

Mar 13, 2007

I have two columns in the look up field. When I select the lookup value in the form I need value from one column to be displayed in one box and the value from the second column displayed in another box. Is there a simple way to do it?
Thanks

View 3 Replies View Related

Lookup For Value In A Field

Apr 30, 2013

I am working on a database where i have to show the user last modification date of the files they are getting the data from. I have already completed that process. Used GetDatetime to find the files last modification date and time. And now i am moving on to the next step and Here is the scenario.

User will click the IMPORT button and first, it will check the last modified date in the form of those files(which is an unbound textbox) and compare that date with the Date Column that exist in the tbl_Import. If the Date matches it will show them a message Saying "Data cannot be imported since it already exist. If it doesnt match it will run the macro i have created to run the data import process

View 1 Replies View Related

Restrict Lookup Field By Value Of Another Field

Mar 9, 2007

Hi gurus,

I have two fields in the main record table with values lookup from two other tables. These two table has 1-many mapping (like country - States). Can I make change within the record table. When I change the value in country field for a record, the States field will only show the states of that country?

Now I have lookup query for these fields from country and states seperately, so no matter what I change in the country field, the states field show all states for all countries.

Thanks for your advice!

View 4 Replies View Related

Lookup A Field Based On Another Field

Mar 15, 2006

Hi, I'm pretty new to access but almost have a database working the way I want it to. I just need help with one thing. I am using PPC Creations on a PDA to fill out a service docket. All the fields export to the DB ok, the problem I have is displaying the info on a report. I have one field to display one of 8 manufacturers and then 8 fields (one for each manufacturer) that display the model. A bit like this...

IntruderPanelType (results are code eg. 1=ADE 2=ADEMCO)
ADE (results are text eg. Optima)
ADMECO
DABOSCH
GARDTEC
MENVIER
SCANTRONIC
TEXECOM
OTHER
OtherIntruderPanelType

So, on my report I want a field (maybe needs to be new) that will display the contents of the relevant manufacturer field, depening on what is in the "IntruderPanelType" field. On the report if "IntruderPanelType" is "1" and "ADE" is "Optima", I want it to display.......

Control Panel Type: ADE Optima

I'm sorry if I'm not making myself clear but if you can understand my ramblings I'd really appreciate a simple solution to this. I've attached a copy of my database so far, in case it helps any! TIA for any help you can give.
Regards,
Brian

View 3 Replies View Related

Lookup Field Row Dependant

Mar 18, 2005

Hi Everyone,

I have a question about lookup fields. I have the tables below. The main table is [vid] and i reference other tables like [manufacturer], [model].. etc. to fill in [vid]. I have pull down lookups for all of [vid] but it is showing all models, makes, etc. I need helping making the lookup row dependant. For example when I am in [vid] and click on the [model] combo box for vid=1, I only want to see the models for that manufacturer(Ford), so it will only show mustang, escape, and navigator; not all of the models. For vid=2, when I click the pull down for model I only want to see Gm Models, corvette and cavalier. So this is what i mean be row dependant. Is this possible?

Thanks so much in advanced,
Michael

[vid]
vid,year,mft, make, model, submodel, ...
1,2005,ford,ford,Mustang,GT
2,2005,GM,Chevrolet,Cavalier, LS
3,2005,dcx,Jeep,Wrangler,base
...
30,2005,ford,Lincoln,Navigator, base

[manufacturer]
mid,mftName
1,ford
2,gm
3,dcx

[Model]
modelID,modelname,modelmft
1, Mustang,Ford
2, Escape, Ford
3, Corvette, GM
4, Cavalier, GM
5, Navigator, Ford
6, Wrangler, DCX

View 2 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

Update A Lookup Field

Apr 20, 2006

I have a table (tblStudent) containing a field named fldTeacher1. Looking at the properties of fldTeacher1 I see that it has a lookup:

Bound Column: 1
Column Count: 2
Column Widths: 0";1" (id number; teacher's Name)

I am trying to run a DoCmd.RunSQL command in code and My question is how do I write a sql statement in code that updates that field with a new value?

I have tried:
DoCmd.RunSQL ("UPDATE tblStudent SET fldTeacher1 = " & Val(txtID) & " WHERE fldID = " & gintStudentID & ";")

All it does is place the id # in the field and not display the teacher's name in fldTeacher1 after the command was run.

View 2 Replies View Related

Field Lookup On Forms

Apr 17, 2005

I am a new Access (2003) user.

I am using one table (Table A) as a data source for a form, using the form to update and edit records. However, I wish to include a field on the form that uses an ID field in Table A to perform a lookup on Table B.

To explain further, I have a staff ID in Table A, and I want to look up and display, but not edit, the corresponding surname from Table B (just for display and convenience - we all recognise surnames rather than ID's).

Many thanks in advance

View 3 Replies View Related

Setting Up A Lookup Field.

Feb 15, 2006

Ok I'll premiss this by saying it has been many years since I have done much with access so I have forgotten alot and alot of things have changed. However I have been using Dataease alot but switched companies so am back to access.In dataease if I had a form called projects and that form had three fields (employee ID, employee first name, employee last initial) that pulled data from another table other than the projects table I would relate them via the employee ID. projects form employee ID = employee form employee IDthen for the two other fields I would have them lookup their data by using the employee id.projects form employee first name = if (projects employee ID = employee employee ID) then lookup employee employee first name. And the same for the last initial.The question is how do I setup for fields for first name and last initial to do the lookup in access.Employee ID TableEmployee ID #Employee First NameEmployee Last InitialProject TableEmployee ID (linked to employee id table)project idproject nameproject discriptionproject start dateproject end dateproject formproject idproject nameproject discriptionproject start dateproject end dateemployee ID (must match employee table employee id)employee first name (read only field that looks its data up from the employee table based on employee id)employee last initial (read only field that looks its data up from the employee table based on employee id)

View 1 Replies View Related

Default Value For A Lookup Field

Apr 14, 2006

Hi Guys.

I have a look-up field in a table that looks-up a range of values from another table. How do I set a default value for the field? I have tried entering in numbers as default values (IE the ID numbers for the records that are being looked up) but that doesnt work.

View 1 Replies View Related

Lookup Field In Report

Aug 14, 2006

I have a lookup field in my table - when I try to create my report, it lists all of the data in the lookup list - I just want to display the one that is stored in the table.

How do I do this?

View 3 Replies View Related







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