F
Fred Boer
I have a form which displays book information for my library database. The
form has command buttons to print spine labels and barcode labels. The
reports are based on a query. The query draws data from three tables:
Tbl_Library, Tbl_Author, and Tbl_BookAuthor, where Tbl_BookAuthor is a
intersection table.
I've run into a problem when I have a book with two authors. In this case,
the query contains two records for the same Book_ID, and, consequently, two
barcode labels are printed...
How can I restrict the printing to only one label? I suppose I'd want the
record which relates to the first author entered...
I've experimented with various joins, grouping, unique values, unique
records, but I'm stumped.
I've included table structures, SQL and Code below.
Thanks!
Fred Boer
Table structure:
Tbl_Library:
Book_ID
Title
CopyNumber
Numberofvolumes
VolumeNumber
Location_ID (Lookup to Tbl_Location)
etc...
Tbl_Author:
Author_ID
Author
Tbl_BookAuthor
Book_ID
Author_ID
Code to run report:
DoCmd.OpenReport "Lbl_DymoSpine", acViewNormal, , _
"[Book_ID] = " & Forms!Frm_LibraryDataEdit!txtBookID
SQL for query used by report:
SELECT Tbl_Library.Book_ID, [Tbl_Author].[AuthorLastName] & ", " &
[Tbl_Author].[AuthorFirstName] & " " & [Tbl_Author].[AuthorMiddleName] AS
Author, Tbl_Library.Title, Tbl_Library.CopyNumber,
Tbl_Library.NumberOfVolumes, Tbl_Library.VolumeNumber, Tbl_Library.Dewey,
Tbl_Location.Location
FROM Tbl_Location INNER JOIN (Tbl_Library INNER JOIN (Tbl_Author INNER JOIN
Tbl_BookAuthor ON Tbl_Author.Author_ID = Tbl_BookAuthor.Author_ID) ON
Tbl_Library.Book_ID = Tbl_BookAuthor.Book_ID) ON Tbl_Location.Location_ID =
Tbl_Library.Location_ID;
form has command buttons to print spine labels and barcode labels. The
reports are based on a query. The query draws data from three tables:
Tbl_Library, Tbl_Author, and Tbl_BookAuthor, where Tbl_BookAuthor is a
intersection table.
I've run into a problem when I have a book with two authors. In this case,
the query contains two records for the same Book_ID, and, consequently, two
barcode labels are printed...
How can I restrict the printing to only one label? I suppose I'd want the
record which relates to the first author entered...
I've experimented with various joins, grouping, unique values, unique
records, but I'm stumped.
I've included table structures, SQL and Code below.
Thanks!
Fred Boer
Table structure:
Tbl_Library:
Book_ID
Title
CopyNumber
Numberofvolumes
VolumeNumber
Location_ID (Lookup to Tbl_Location)
etc...
Tbl_Author:
Author_ID
Author
Tbl_BookAuthor
Book_ID
Author_ID
Code to run report:
DoCmd.OpenReport "Lbl_DymoSpine", acViewNormal, , _
"[Book_ID] = " & Forms!Frm_LibraryDataEdit!txtBookID
SQL for query used by report:
SELECT Tbl_Library.Book_ID, [Tbl_Author].[AuthorLastName] & ", " &
[Tbl_Author].[AuthorFirstName] & " " & [Tbl_Author].[AuthorMiddleName] AS
Author, Tbl_Library.Title, Tbl_Library.CopyNumber,
Tbl_Library.NumberOfVolumes, Tbl_Library.VolumeNumber, Tbl_Library.Dewey,
Tbl_Location.Location
FROM Tbl_Location INNER JOIN (Tbl_Library INNER JOIN (Tbl_Author INNER JOIN
Tbl_BookAuthor ON Tbl_Author.Author_ID = Tbl_BookAuthor.Author_ID) ON
Tbl_Library.Book_ID = Tbl_BookAuthor.Book_ID) ON Tbl_Location.Location_ID =
Tbl_Library.Location_ID;