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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlighting specific records in a subform

Status
Not open for further replies.

Ziggurat

Programmer
Jun 6, 2001
81
GB
Hi Everyone,

I have hit a bit of a snag in a little Access program that I am writing.

I have a form frmReader that displays the information about a reader. On the same form is a subform called "frmBooks". The frmBooks sub form displays all the books in the library.

What I would like to do is to highlight the books in the subform that the reader has read so the reader can immediately recognize those books.

I have created a table called tblReader which contains the reader's info with a reader_id code.

The tblBooks table contains a list of all the books with the book's author etc. with a book_id code

And a table called tblReadBooks which contains a list of all the books read by all the readers by using the keys reader_id and book_id.

Is doing this with a subForm the best way of doing this. Can you suggest how can I highlight the books that have been read from the books that have not been read.

If it isn't the best way to display the information please give me an idea on how to display it.

Thanks in advance.

#
###
#####
#######
Ziggurat
 
As far as how to highlight those read vs not read, that will depend.

What version of Access are you using?

If you're using Access 2007 or newer, you can use conditional formatting, like in Excel. Assuming you have some field that designates "read" or "not read", you can base the condition for the format on that field. You'll probably have to play around with using an Expression, assuming you want to highlight the entire record and not just one field of the record.

Also, if you're using Access 2007 or newer (though I think it is possible with older versions as well, just don't remember for sure), you can create a split for that will basically act the same as what you're using a form and subform for, and might make it easier to accomplish what you're looking for. Not sure right off hand, though.
 
Hi kjv1611

Thanks for the feedback.

I forgot to mention that I was using Access 2010 and the records are displayed in a continuous form.

I had already looked at "Conditional formatting" but it only seemed to be concerned with changing the fore/back colour of the field.

However you mentioned using an expression.
Where would you write and assign the expression for the conditional formatting?

Also what level of control can you have with an expression?

For example could you make a button on the continuous form visible or invisible

Thanks in advance

#
###
#####
#######
Ziggurat
 
Well, with using an expression, you're still only highlighting the cells via back/fore color. If you want something more like a colored box around it, then you'd have to have a box there that's hidden, and then have some vba code make it visible for selected records.

As far as where you use the expression, you do that in the conditional formatting tool. Where it says "Field Value Is" - you change that to "Expression Is", and then fill in your expression. I've not used the expression option in Access, but I think it'll work the same as a formula in Excel in conditional formatting, which I've used at least once or twice... mainly by the help of one SkipVought who hangs around these forums - mainly Excel-related.

When I used the colored box method in the past, I used that to "highlight" or show the currently selected record on the form. I didn't try to use it with multiple records.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top