A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query to look up value from other field



 
 
Thread Tools Display Modes
  #1  
Old February 13th, 2007, 04:26 PM posted to microsoft.public.access.queries
Diggsy
external usenet poster
 
Posts: 19
Default Query to look up value from other field

Hello,

I am currently working on a query that looks up a specific field based on my
hardcoded input. I have 52 fields in a table named Forecasts The fields are
Named Week 01 Forecast to Week 52 Forecast. If I hard code a specific value
as in my example... it will retrieve the data in Field Week 08 Forecast. I am
try to find a way to automatically update the name by changing the middle
part ..08 ...to a value from a field called WK which contains a 2 digit
number based on other paremeters in my query. For instance if the data in WK
Field was 03. Is there a way I can call that in my query instead of having to
hardcode it every time?



Currently
Forecast: [Forecasts]![Week 08 Forecast]
would like [Forecasts]![Week [WK] Forecast] to give me [Forecasts]![Week 03
Forecast]


I know it can be done I think I am having syntax errors. Any sggestions
would be helpful.

Thanks

Chris
  #2  
Old February 13th, 2007, 05:22 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Query to look up value from other field

You can't parameterize the field name.

You could move your spreadsheet to Excel or possibly normalize it in Access.
The week number should be a value stored in a field named "WeekNum" or
similar. Each forecast value should create its own record.

--
Duane Hookom
Microsoft Access MVP


"Diggsy" wrote:

Hello,

I am currently working on a query that looks up a specific field based on my
hardcoded input. I have 52 fields in a table named Forecasts The fields are
Named Week 01 Forecast to Week 52 Forecast. If I hard code a specific value
as in my example... it will retrieve the data in Field Week 08 Forecast. I am
try to find a way to automatically update the name by changing the middle
part ..08 ...to a value from a field called WK which contains a 2 digit
number based on other paremeters in my query. For instance if the data in WK
Field was 03. Is there a way I can call that in my query instead of having to
hardcode it every time?



Currently
Forecast: [Forecasts]![Week 08 Forecast]
would like [Forecasts]![Week [WK] Forecast] to give me [Forecasts]![Week 03
Forecast]


I know it can be done I think I am having syntax errors. Any sggestions
would be helpful.

Thanks

Chris

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.