Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access Continous Form - Highlight change of "Product Code"

Posted on 2011-02-14
3
Medium Priority
?
318 Views
Last Modified: 2012-05-11
I have 4000 records displayed in a continuous form.

Each record shows a "Product" and a selling price and "Check Price" flag.   The user will review hundreds of records on tghe screen and occasionally click on the "Check Price" flag.

The form shows the data in product sequence.
Each product can occur MULTIPLE times.

Question: This question applied to continous forms in general.  Is there anyway I can highlight when the "Product Code" changes.
0
Comment
Question by:Patrick O'Dea
3 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 34889485
Access can't really track the "previous" record using conditional formatting, so I don't see how you'd do this. In order to highlight when the Product Code changes, you'd somehow have to know what the previous value was, and that's not something that is available for CF.

0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 1000 total points
ID: 34889767
There are a couple of approaches but they are not easy..

There is no concept of Previous or Next in Access queries so you have to use record key values to get the record with the next lower value (for previous) or next higher value(for next).
This means that PROVIDED the records have a unique key and are sequenced on that key then you can find the previous record value and you can then utilise conditional formatting to highlight each new number.
However this sort sequence usually means that other like values (Product in this case) are NOT adjacent and so the technique can't be used.
 
Alternatively you can write a function that uses a recordset with the same sql as your form, which should therefore be in the same sequence as your form, and for each record you can use Moveprevious and/or Movenext commands to see if the previous/next record was for the same product.  This will always work provided you have an unambiguously defined record sequence - it would be entirely hit and miss if the sort order could produce different results and still be correct.   So if you sort only on Productid and there can be several records with the same productid you cannot predict the sequence of records within each productid  - so you must use another sort field to force each set of the same productid into a definite and reproduceable sequence.  If you don't do this then the record sequence in the form might be different to the record sequence in the function's recordset.
The function can return a 'Same' or 'Different' result and you can then use conditional formatting to highlight the values.
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 34890796
Thanks all,

In particular peter57r .... I will try your suggestions later.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question