Access continuous forms -- how to individualize controls per record? - ms-access

I have an Access form displaying a tiny amount of data for a certain type of record. Basically it just prints the name on the left and on the right has a bunch of Rectangle controls whose background color I change in the form's OnLoad() function, according to results from a query performed using that record's ID as parameter.
This all worked fine, got my ID/name on the left and 31 boxes on the right, colored if that day of the month is reserved :) But needless to say that function can be completely arbitrary since it's code.
Then I decided to switch to 'continuous form' as to display as many records/items as possible. But alas, it was not to be -- all boxes were colored according to the query/function performed for the first record only. I figured that might be because it's the OnLoad() but changing it to OnCurrent() did not do much either. As it turns out, or that's what I read, the Rectangle intances are shared over the entire form and if I change the BackColor for one of them it changes for that box for each record.
I want to be able to change this according to a query performed on a per-record basis. Is there any way? Up until now I've only been able to find conditional formatting (the feature that's nor available for rectangles nor seems to cater my exact needs?) and kludgy Access 97 text-box hacks.
Thanks in advance :)

You may be coming from an HTML background, where rectangles would be a natural solution. They aren't in Access. I don't think they'll work for you (in fact, "kludgy" could describe the attempt in my humble opinion).
You can however display an image. You'll keep an image for each status ready to call up. I've made visual displays this way. A little later I may be able to post some code, but I think you'll find this plays out pretty simply even if I don't.
ADDED NOTE: I'm glad this looks like it will work for you. You are concerned about "instanced only once" in your comment below. Yes, that's true for rectangles which are unbound controls (because they are designed for mere ornamentation). But you'll be using an image control which is a bound control (see Remou).

Change each rectangle to a text box, Control Source:
=Iif(myConditionIsMet,"ÛÛÛÛÛ","")
The "Û" is the Full Block character in Arial (asc 219).

All unbound controls in a continuous form will be the same; bound controls can be varied using conditional formatting.

Related

Allow page breaks inside the row/cell of Tablix

Not really new to SSRS but still can not get around the issue that bothers me for some time ...
So I have a page with title, some text box, then Tablix, then another textbox ...
Tablix is getting different user comments, some are short some are rather long and those long are making problems ...
So I'm trying to avoid that white space coming from (page break I presume).
Almost forgot ... problem is there where I render report in PDF. That is what is the most important to work.
I'm not that new and I know how to disable 'Keep together' options and I can only say that I did.
I also tried and checked all the statics (on Grouping with Advance view enabled).
I'm also prepared to make as many attempts as needed to get to the bottom of this so please do not hesitate to type every step you think I should follow etc. Also I'm willing to give any additional info you may require just ask ... was trying not to write a novel for a problem you can easily spot on image.
Thanks in advance!

How is this website performing this particular function?

I am looking at this website here, https://www.symbolab.com/
, and in particular the matrix entry function on it. Pressing the icon with the brackets to the left of the H2O icon will take you to it.
Now, you are then prompted to enter your own user-defined size of matrix. Below then in a text area then appears the blank matrix, with the predefined text fields arranged in an array.
I am wanting to replicate something similar myself, and was wondering how this site was performing this function. I am new to HTML and was wondering what components were being used here? Is the larger area that the matrix is contained in a canvas? Are the fields of the matrix Input Type Text fields? If so, how is the resizing dynamically achieved as the user enters text?
Anyone know? :)
Jeremy
The first step when you want to know what's happening behind a website is to open the console and look at the code and scripts. I think that the textarea used into your example is a basic textarea.
If your looking for a textarea that auto-resize, you can achieve this in JS. Maybe that post can help you.
If your looking for a way to write math formula into an HTML page, there is several solutions for you on the web. That stackoverflow post propose to use MathJax.
Hope it helps you a bit.

SSRS Charts: solution for better assignment of colors to the legend

If you have a line chart in SSRS with many lines, it is nearly impossible to identify which line belongs to which item in the legend, as the colors are nearly the same. Is there a better solution?
bad example of line chart legend
Some suggestions that may help:
Group some of the values into an Other group. It looks like you have
some values that come and go, or don't run for the full timeframe of the
report, lumping these into an Other group will mean less legend items.
Move the legend to the bottom of the chart. This can sometimes make
the legend easier to see; this is not a good option when have a lot
more legend items than what you have now.
Use more than one chart; one chart for each line is possible. This
may be a good option for you. Use more than one chart, and only
display certain values in each. Perhaps you have some natural
grouping in the data that isn’t obvious from what you have provided
in the question. If you do, use that to separate the values into
different charts.
Use a different color theme. The theme you are using now would leave
any color-blind person wondering what was in the chart at all.
Make the chart larger. You just never know, this may work.
Use a column chart rather than a line chart. The bars are wider, and
can be easier to see. Plus, with the way your values come and go, it
may be a better way to visualize the data.
Limit the timeframe of the data being displayed. Having less data may
make this look better, but that may defeat the purpose of the report.
Still, it’s an option.
Good luck.
All good ideas by R Richards. I often end up with charts looking like yours. The first thing I do is ask. Is this of any use to the end user, if not I'll try to rationalise the chart. Some of the ideas in the earlier answer are things I try but also you can try the following without reducing the amount of data in the chart.
Simply make the lines thicker, it's much easier to identify the colours with thicker lines.
Add tooltips to the data points so that the user can hover over the
lines and get info about the line and/or point.
Use a custom pallet, the default palette does not have many colours in (7 I think), so colours are repeated. Creating a custom palette with more colours will make it easier to identify each line. It also means, if you can ensure the order of series in your data that you can you produce consistent charts were a colour always represents a specific business object.
If you have breaks in the data, change the chart to use an average
to give you a continuous line. I think your x axis has to be set as
a time type for this to work, I can't remember off the top of my
head.
Here's a before and after the first two ideas were applied to a sample chart I built.
If you think you need to reduce the data, group line with smaller values together and then add a drill down chart to show these lines.

Dynamic continuous form height

I currently have a form that has a continuous subform in the footer to show "comments" for the original form record.
My issue is that each comment is of an undetermined size. I am trying to find a way to dynamically change the height of each section in the continuous form to match its contents.
Reading around online I found a lot of people saying this couldn't be done (a few years ago, so whether this is still the case I am not sure) so I tried instead to layout my own "continuous form" in the form header of the subform. This involved creating a text box for each comment using the CreateControl method. Unfortunately this method didn't work either, the new controls completely failed to appear on the form at runtime.
I am sure there is some way this can be done (maybe an alternative method to achieve the same effect) but I can't seem to find it.
Anyone had experienced with this problem or any ideas on how else I may achieve the desired result?
Each record in the subform will always be the same height (the Detail section height). What I've done in the past is to make it fairly small but add a button (or use the Click event of the text box) to open the Zoom box with the whole commment.

How to implement text selecting?

My question is not language based or OS based. I guess every system is offering some sort of TextOut(text, x, y) method. I am looking for some guidlines or articles how should I implement selection of outputed text. Could not find any info about this.
The only thing which comes to my mind is like this:
When user clicks some point on the text canvas I know the coordinates of this point. I need to calculate where exactly it will be in my text buffer. So I am traversing from the begining of the buffer and I am applying to each character (or block of text) a style (if it has any). After this, I know that after given style the letter has given size. I am adding its width and height to previously calculated X,Y coordinates. In this way, I am traversing the buffer until the calculated position has not reached the point that has been clicked by the user. After I reach the point within range of some offset I have starting point for the selection.
This is the basic idea. I don't know if this is good, I would like to know how this is done for real like for example in Firefox. I know I could browse the sources and if I won't have a choice I'll do it. But first I am trying to find some article about it...
Selecting text is inherently specific to the control which is containing it and the means it stores that text.
A very simple (though questionably inefficient means) is to run the text flow algorithm you are using when clicking on a point and stopping the algorithm when you have reached what is closest to that point. More advanced controls might cache the text layout to make selections or drawing their content more efficient. Depending on how much you value CPU time or memory there are ways to use caches and special cases to make this “hit test” cheaper.
If you can make any assertions (only one font in the control, so every line has the same height) then it is possible to make these tests cheaper by indexing the font layout by lines and then doing simple arithmetic to find out which line was clicked on. If your text control is also using monospace fonts (every character occupies the same width as well as height) then you are in even more luck, as you can jump straight to the character information via a lookup table and two simple divisions.
Keep in mind that writing a text control from scratch is obscenely difficult. For best practice, you should keep the content of the document separate from the display information. The reason for this is because the text itself will need to be edited quite often, so algorithms such as Ropes or Gap Buffers may be employed on the data side to provide faster insertion around the caret. Every time text is edited it must also be rendered, which involves taking that data and running it through some kind of formatting / flow algorithms to determine how it needs to be displayed to the user. Both of these sides require a lot of algorithms that may be annoying to get right.
Unfortunately using the native TextOut functions will not help you. You will need to use methods which give you the text extents for individual characters, and more advanced (multiline for example) controls often must do their own rendering of characters using this information. Functions like TextOut are not built to deal with blinking insertion carets for example, or performing incremental updates on text layouts. While some TextOut style functions may support word wrap and alignment for you, they also require re-rendering the entire string which becomes more undesirable in proportion to the amount of text you need to work with in your control.
You are thinking at a much lower level than necessary (not an insult. you are thinking that you need to do much more work then you need to). Most (if not all) languages with GUI support will also have some form of selectionRange that gives you either the string that was selected or the start and stop indices in the string.
With a modern language, you should never have to calculate pixels and character widths.
For text selection in Javascript, see this question: Understanding what goes on with textarea selection with JavaScript