473,386 Members | 1,673 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,386 software developers and data experts.

how do i look up the value of a cellusing access?

I have imported a number of tables into my access db, and i'm now writing a program that needs to look up values from these tables.



for example,

iif(fac<[value in third column 5th row], 1, 0)



how do i look up the value using access?
Nov 25 '08 #1
4 1142
PianoMan64
374 Expert 256MB
Hey kwokv616,

Well, I can tell from what you're describing to me, you've been working in Excel for a great deal of time. Now that being said, I need to explain a few concepts to you that greatly differ from using Excel.

1. With excel you have a static list that is always kept in the order that it appears in the excel spreadsheet. With MS Access, this is a list of item that is kept in a format that is fluid at all time. there is not set order because there are records that are being added and removed, and it will find a place for new records that replaces old records that have been deleted as time go one.

So that prevents you from refering to an item in a table as being in a set order. because it can all be changed simply by sorting the table in a different manner.

2. One thing that is required when developing tables from MS Access is a Unique ID field that is part of the table structure. Like in Excel, you have a row number for each item in the list, In MS Access there is unique ID that will Identify each record in the table uniquely. This way if you need to get to a specific record, you're simply would have to give it the record Unique ID, and it will locate that record.

I know these concepts are different, but you'll have to understand them and many others before you can being to manipulate any data within tables.

Another concept to understand is Indexing.

And example of Indexing is: Lets say you have a last name list of:

Anderson
Zebo
Franklin

If they were indexed, they would be sorted as

Anderson
Franklin
Zebo

This way if you're searching for something by last name, you would be able to find that record right away because the index would exactly what record(s) that last name would be in.

Now to simply answer your question, you're going to need to define within the table what "fac" is and how that relates to the value that you're wanting to look at in column 5.

Take for example you have a table with the following fields in them.

Expand|Select|Wrap|Line Numbers
  1. ID          FirstName          LastName          PhoneNumber 
  2. 1           Fred               Flinstone         123-456-7890 
  3. 2           Barney             Rubble            123-456-7891 
  4.  
If you want to be able to search for lastname Rubble, you would create a query, that would have the following information

Expand|Select|Wrap|Line Numbers
  1. Select FirstName, LastName,PhoneNumber FROM TableName WHERE LastName = 'Rubble'
  2.  
So this is how you would search for specific information within tables.

If you create a query, you can specify what fields you want, from what table, and the condition that you want the records returned in?

If you have any more details questions, please feel free to ask, I would be more than happy to help.

Joe P.
Nov 25 '08 #2
age y0 y1 y2 y3 y4 y5
0 0.3067 0.2537 0.1978 0.1392 0.105 0.0794
1 0.3073 0.2538 0.1978 0.1392 0.105 0.0794
2 0.3074 0.2538 0.1978 0.1392 0.105 0.0794
3 0.3074 0.2538 0.1978 0.1392 0.105 0.0794
4 0.3074 0.2538 0.1978 0.1392 0.105 0.0794
5 0.3075 0.2539 0.1978 0.1392 0.105 0.0794

This is part of a table that i imported.

the first row with "age", "y0-y5" are column names.
in the vba codes im writing, there will be a value for age, and tmpyr (a variable) = "yx"

when given the value of age and "yx", i will need to calculate r=fac*max(dur,the value in cell[age,Yx])
that is y i need to lookup the value in a cell given a position instead of finding a cell value given some criteria.

is it possible to do this in access?

thanks =)
Nov 25 '08 #3
PianoMan64
374 Expert 256MB
Hey Kwokv616,

Hello again. I have one question about the formula that you're showing r=fac*max. How does that relate to the values that are in the table which value is fac, and which value is max?

Now with a little assumption on my part I can show you an example of what I was talking about before with the information that you provided?

One of the recommendations that I would do is to simplify the table structure like this:

Expand|Select|Wrap|Line Numbers
  1. TableName: AmozInfo
  2. ------------------------------------------------------------------------
  3. Fields
  4. ------------------------------------------------------------------------
  5. ID              Primary Key (AutoNumber)        Primary Key valuu
  6. AGE             Integer                         Age of Client/Customer
  7. TheYear         Integer                         What Year 
  8. Offset          Currency                        What the Offset
  9. ------------------------------------------------------------------------
  10. Sample Data would be:
  11. ID (Will autogenerate)
  12. AGE = 0
  13. TheYear=0
  14. Offset=0.3067
  15. and so on according to your chart.
  16.  
  17.  
  18.  
So as you start to import that information in, you can do a simple select statement like

Expand|Select|Wrap|Line Numbers
  1. SELECT TheYear*Offset FROM AmozInfo WHERE TheYear=1 AND Age = 2
  2.  
This way you can search for an item where you've giving it the values that you know, "age" and the "years", then have it look it up in the table.

If you're wanting to do that within vba, if you would post your code that you have so far I can figure out what you need to do. Cause I'm not sure what the variables that you're describing are realted too. I can only assume.

Thanks and await your response.

Joe P.
Nov 26 '08 #4
Thank you very much for your reply! I have solved the problem now using Dlookup!
It is actually quite simple =P

I wrote:
temp = DLookup("Y" & dur, "mk" & sex, "Age =" & iage)
temp2 = DLookup("Y" & (dur + 1), "mk" & sex, "Age =" & iage)
in order to get the cell value in Column"Yx" and row "age"

thank you so much for you help!
Nov 27 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: FAQPoster | last post by:
An HTML version of this document is available at: http://www.mvps.org/access/netiquette.htm Feeling left out? Alone? Wondering why everyone's ignoring you? Or why you're being flamed for what...
0
by: FAQPoster | last post by:
An HTML version of this document is available at: http://www.mvps.org/access/netiquette.htm Feeling left out? Alone? Wondering why everyone's ignoring you? Or why you're being flamed for what...
0
by: FAQPoster | last post by:
An HTML version of this document is available at: http://www.mvps.org/access/netiquette.htm Feeling left out? Alone? Wondering why everyone's ignoring you? Or why you're being flamed for what...
0
by: FAQPoster | last post by:
An HTML version of this document is available at: http://www.mvps.org/access/netiquette.htm Feeling left out? Alone? Wondering why everyone's ignoring you? Or why you're being flamed for what...
3
by: Simon | last post by:
Dear reader, For matching of two fields it is required that the fields has the same content. But now I have the situation that two text fields has not precisely the same content but there...
6
by: grego9 | last post by:
I am trying to return a value from an access database by looking up a value in excel. This is the code I have copied from another source - but I cannot get it to work - I keep getting a run time...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...

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.