is it that complex?

A

asd987

Hi,

I have a problem to print the correct data to a file.

I have two tables:
1. "names" with the records
- "id" (autonumber / primary key)
- "description" (text)

2. "things" with the records
- "date" (date)
- "object" (memo)
- "name" (this refers isong lookup to table "names" the record "id")


I do:

print #1, rstfile2!date
print #1, rstfile2!object
print #1, rstfile2!name

As expected I get a number on the third print-command. I tried several
things to get the "description" of the "id" printed but didn't succeed.

Even when I do a

Select Case rstfile1!id
Case rstfile2!name
Print #1, rstfile1!description
End Select

while looping rstfile2 it doesn't work. Above that I think it could be done
much more easy than using the Select Case and looping-story. But how?

Thanks,

Sjoerd
 
D

Douglas J. Steele

The problem is that you're using a lookup field in your "things" table. It
may look as though you're storing the description, but it's not present in
the table. You need to create a query that joins your table to the table
that contains the description, and get the description that way.

This is one of the reasons we recommend never to use the Lookup field type
(see "The Evils of Lookup FIelds in Tables" at
http://www.mvps.org/access/lookupfields.htm )
 
S

Sascha Wostmann

asd987 :
Hi,

I have a problem to print the correct data to a file.

I have two tables:
1. "names" with the records
- "id" (autonumber / primary key)
- "description" (text)

2. "things" with the records
- "date" (date)
- "object" (memo)
- "name" (this refers isong lookup to table "names" the record "id")


I do:

print #1, rstfile2!date
print #1, rstfile2!object
print #1, rstfile2!name

As expected I get a number on the third print-command. I tried several
things to get the "description" of the "id" printed but didn't succeed.

if you don't want (or can) change the data source for the export, use:

print #1, dlookup("description","names","id=" & rstfile2!name)

but this is quite slow on large exports, since each lookup has to be
done seperately.

BTW, don't use "name" as column name because it's used internally too.


Viele Grüße,
Sascha Wostmann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top