Dale, Thanks for all of this info. I follow most of what you are saying, but
am not expierenced enough for all of it. If you don't mind, I'll tell you
what I don't understand and maybe you can give more details (my
inexperience). This is the query I have now:
SELECT Detail.MasterID, Detail.BookID, Detail.Year, Detail.Page,
Detail.Info1, Detail.Info2, Detail.Maiden, Master.Last, Master.First,
Master.Middle, Master.Title, Book.BookName, Detail.ID
FROM Book INNER JOIN (Master INNER JOIN Detail ON Master.ID =
Detail.MasterID) ON Book.ID = Detail.BookID
ORDER BY Detail.Year, Detail.Page, Detail.Info1;
I have a Cemeteries table (this is for genealogy) that links with Master.Id
(Cemeteries.MasterId). I tried to add the table to my query and got an
'ambiguous joins' error. I don't know how to do a left join.
I think I follow about the field 'HasDetails' but I am confused whether this
becomes a new 'button' that I can click on to go to my next form and/or what
to do with the command button I have now, which opens inquiry form for that
MasterId of Cemeteries data. My forms are all continuous.
If this is just too much to try and explain, I understand. I will still try
and do something with this info. I really appreciate the information you've
given.
thanks, Sherry
p.s. Just a note: I also know which books (Detail.BookId) have Cemeteries
records. Currently, there are only 4 books, but this number will grow to
maybe around 80 as I get more data ready for the system.
Dale Fye said:
Sure.
In the query that is the RecordSource for your inquiry screen, I would add a
field "HasDetails" or something like that. You could do this by joining the
table to the details table using a left join. Then add a field (DetailsID?)
to the query with something like:
HasDetails: IIF(ISNULL(tblDetails.DetailsID), False, True)
or, without the join:
HasDetails: (DCOUNT("DetailsID", "tblBookDetails", "BookID = " & [BookID]) >
0)
Then when the user selects a book (you don't say whether this is a listbox
or a continuous form) either the Current or Click event will fire. In the
code associated with that event, do something like:
me.cmd_ShowDetails.Enabled = Me.[HasDetails]
or if using a listbox
me.cmd_ShowDetails.Enabled = (me.lstBooks.column(x) = -1) 'replace x with
the column # corresponding to the HasDetails column
HTH
Dale
SherryScrapDog said:
I have an inquiry screen that shows a list of books a name exists in. I
have
another table that has additional information for some of the records and
they are connected to the name. I have a command button to access a form
with the additional data and this all works fine. However, only some of
the
records have this additional record. Can I determine whether to show the
button based on either whether the additional record exists, or by the
BookId
(which will be multiple)? Thanks, Sherry