Thread View: comp.databases.ms-access
3 messages
3 total messages
Started by asd987
Sun, 23 May 2004 11:06
is it that complex?
Author: asd987
Date: Sun, 23 May 2004 11:06
Date: Sun, 23 May 2004 11:06
37 lines
2339 bytes
2339 bytes
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
Re: is it that complex?
Author: Douglas J. Steele
Date: Sun, 23 May 2004 11:21
Date: Sun, 23 May 2004 11:21
57 lines
2924 bytes
2924 bytes
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 ) -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "asd987" <asd987@home.nl> wrote in message news:c8q0k8$47o$1@news2.tilbu1.nb.home.nl... > 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 > >
Re: is it that complex?
Author: Sascha Wostmann
Date: Sun, 23 May 2004 22:36
Date: Sun, 23 May 2004 22:36
43 lines
2522 bytes
2522 bytes
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
--
wichtige Informationsquellen zu Access: +----------------------
http://www.donkarl.com/ (FAQ) | Bitte keine Kopien
http://www.freeaccess.de/ (KnowHow) | oder Access-Anfragen
http://www.google.de/ (Suchmaschine) | per E-Mail.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads