473,406 Members | 2,343 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,406 software developers and data experts.

dlookup or find methods for fileds using balue for field name

3
i read the thread entitled "Convert Field Value String to Actual Field in Expression"

It appeared that the final solutions got moore complex not less complex

MY PROBLEM IS:
1. get a value from one table as a string
2. lookup the value of a field in a second table
where the field name = the value of field in table 1

I CAN GET THIS USING DLOOkUP, BUT NOT BY FIND METHOD
example:
c = value from tableR2 (if [PART] - "AN" then c = "HD1")
cx = date from tableR!
(find record using findfirst and get value from filed "HD1")




HERE IS MY CODE
Dim CX As Variant 'Specific HX DATE
Dim C As Variant
DIM SQL as String



Dim R1 as Recordset
' HX_DATES (PATID as Long), HD1, HD2 HD3 HD4 as Dates (double)
Dim R2 as Recordset
'HX_LIST ( PART as string) LIST OF HX VALUES
C = Null
CX = Null
SQL = "Select * from HX_LIST where [PART] = 'AN' ;"



Set R1 = DB.OPENRECORDSET("HX_DATES", Db_readonly)
SET R2 = DB.OPENRECORDSET (SQL)

PROBLEM:
Moving to first record of R2 gets value of "H01" (this is a string)
As example R2!H01 = #2/3/2006#
=========
THIS WORKS: CX = DLookup("" & C & "", "tmp_hex", "patid = " & PATID)

WHAT I WANT IS
R1.findfirst "PATID = " & PATID (This works)
C = "R!" & C (Makes C = R1!H01)
CX = R1!H01 (I want CX = #2/3/2006#)
Oct 22 '06 #1
1 1242
PEB
1,418 Expert 1GB
Maybe you have more than resulting value in your R2?

In fact you obtain a string instaed date? Is it the problem?
Oct 27 '06 #2

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

Similar topics

6
by: JLM | last post by:
What am I missing here? I have a form where I enter a "Class Code". This value corresponds to what sits in table "class code descriptions" along with the "title" of each "class code." Key...
6
by: LSemos | last post by:
I am trying to lookup phone numbers in a separate table based on the name in the current Tab control tblContacts has the fields: Name, Phone, Fax, and Email In my Form's Tab control, I have...
4
by: basstwo | last post by:
I have a field with a serial number in it. I want to use Mid to extract the 4th and 5th characters, use them to lookup a value on a small lookup table, and use the info from that table to fill in...
8
by: Christine Henderson | last post by:
I have a problem using the above function in the following simplified circumstance: In the lookup table called "Klms Travelled" I have 3 fields, eg: Receiver Name Receiver Suburb ...
6
by: Don Sealer | last post by:
I've written this expression for a DLookup function. It works almost alright. What I'm trying to do is type in a description and the ID field (number) populates automatically. It works almost as...
1
by: BobM | last post by:
i read the thread entitled "Convert Field Value String to Actual Field in Expression" It appeared that the final solutions got moore complex not less complex MY PROBLEM IS: 1. get a value from...
1
by: BobM | last post by:
i read the thread entitled "Convert Field Value String to Actual Field in Expression" It appeared that the final solutions got moore complex not less complex MY PROBLEM IS: 1. get a value from...
1
by: Deac | last post by:
I was asked to help a friend with a database and am in over my head! The customer table has been in place and they have used a paper copy of the pricing table to make manual changes and...
6
by: David Wright | last post by:
Hello Folks I am using Microsoft Access 2000 I would be grateful if someone could help me with “Dlookup”. I tried various methods of writing Dlookup and various events to trigger it, none of...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.