Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Data from one field into another using Criteria in a Query

Status
Not open for further replies.

CindiN

Instructor
Jan 30, 2001
98
US
Hi, I posted this in queries, but got no response, so I hoping someone here can help me.

Can anyone tell me what to write in the Criteria row of a query that will copy the data from one column into another? In other words, I have 3 columns; "Course_Code", "Course_Desc" and Training_Units that all come from the CourseTBL. I have a 2nd table that is CourseResultsTBL that also shows the same 3 fields. (I know it's wrong, but it was downloaded from main system this way and too many records to change). Now, my query pulls the "Course_Code" from the CourseTBL and it pulls the "Course_Desc" and "Training_Units" from the CourseResultsTBL. That way the user only has to enter the Course_Code on the Form and it automatically fills in the other two fields. My problem is that I still need the other two fields to be filled in on the CourseResultsTBL also. So, I thought I'd just add them to the query and put some sort of criteria in that would copy the CourseTBL results for Course_Desc and Training_Units in the CourseResultsTBL fields that are in the same query.

I hope that makes sense. I think some way of writing the DLOOKUP will do it, but it's not working for me. I'm not really too familiar with VB, so if there's a way to do this in the Criteria, I would understand better.

Thank you so much!
CindiN
 
i would use dlookup

dlookup("field to lookup","table name","query")

for example...

dlookup("Course_Desc","CourseResultsTBL","Course_Code=" & [Course_Code])
 
Hi JavaTurkey,
Thanks for the response, I really appreciate it. I tried the dlookup, but it didn't work. Here's what I did:
I created a query called "ForEmplCourseUpdateQRY" and put the 3 fields in it from the CourseTBL. I then went to the Form and in the Record Source I added to the statement the dlookup. Here's what it looks like:

DMV_CUR_EMP_CLAS_RESUT ON DMV_CUR_COURS_OFFERING.CD_COURSE_CODE = DMV_CUR_EMP_CLAS_RESUT.CD_COURSE_CODE WHERE (((DMV_CUR_EMP_CLAS_RESUT.CD_COURSE_DESC)=DLookUp("CD_Course_Desc","DMV_CUR_EMP_CLAS_RESUT","CD_Course_Code"=" &[ForEmplCourseUpdateQRY]! [CD_Course_Code]")));

The results are empty. Can you tell from this what is wrong?
Thank you sooo much,
CindiN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top