Collections Class on continous forms

thechazm

VBA, VB.net, C#, Java
Local time
Today, 03:27
Joined
Mar 7, 2011
Messages
515
I am wondering if anyone has figured out a way to make objects to support adjusting continuous form controls making them unique in a sense to be able to change info like captions or whatever.

I've been working with collections for a while now tapping into event handlers such as the mouse inputs and or sizing of objects real time using collections but I can't seem to nail down any un-documented way to serialize controls on a continuos form.

I have tried when the new user creates the record adding another control to the collections class tying it to the id of the record but still this does not seem to be enough.

I do not know if there is a paint meathod or something of the sort I can override to get the desired results and most people without even trying will tell you this can't be done but how many have said that you can't move and resize objects in access but we are doing that now...

Anyway comments and thoughts are welcome just trying to think outside of the box.

Thanks,

TheChazm
 
Maybe specify what language you are working in. Overriding a method suggests a .NET language, but continuous form suggests Access's VBA.

Also, some of this language is difficult to understand . . .
make objects to support adjusting continuous form controls making them unique in a sense to be able to change info
Maybe the answer is hard to find because the question is not clear?
 
Thanks for the reply lagbolt but you can in fact override or provide access vba the ability to detect and tap into certain events through collection classes. It's the same concept as .net or java or whatever OO language but it still works with vba just in small portions.

I want to assign controls on a continuos forms unique ID's so I can change each one independently of the other is all the above statement was saying. I do apologies if I didn't make it seem clear. I'm going to continue to investigate different ways of making this happen I was just hoping someone had maybe already figured it out since I am trying to produce a drag and drop manning interface using continuous forms in access adjusting the labels as needed.

The dragging and dropping of objects I have already completed and seems to work really well it's just the modifications of these label's captions and or command buttons that seem to elude me in my efforts.

Again hopefully this makes more sense but I'm making access do a lot of things it really shouldn't but hey it's fun :D
 
I don't think you can separate the controls by record on a Continuous form because they are really the same control repeated.
 
As Galaxiom notes, the controls in a datasheet or continuous form are really only those that you see in design view, and so the controls themselves are not unique instances in different rows. If you change a label caption, for instance, it changes in all rows of a datasheet or continuous form. Of course internally, at some level, they controls must be unique instances, but I don't know, in VBA or using objects exposed by Access, if you can achieve programmatic access to those structures.

Certainly if you find a way, I'd be very interested if you'd post back about how. In this respect though, a datasheet is not like a .NET gridview or dataview control, and there is no RowDataBound() event you can handle to tweak a datasheet with such fine precision.

But you can change data in a table, and table data can be displayed in a bound control in a datasheet, so if you drop data onto a control in datasheet view, you can identify the Primary key for that record, update data in that row the table, and have that displayed in your datasheet. And you can make a textbox look like a label. Does that make sense? Maybe that can be a work-around?
 
Continuous Forms are just a concept that the user doesn't really want or need to know about.
So all we have to do is make it look like a continuous form to keep them happy.

Drag, drop, resize and save on what looks like a continuous form.
It is going to take a lot more work but it's doable.

As Donald Sutherland once said in a movie, "always with negative waves" :)
http://www.youtube.com/watch?v=KuStsFW4EmQ

Demo attached.

Chris.
 

Attachments

ChrisO, FYI

I downloaded your solution. I know you stop at 2003 so I tested it for you in 2007 and it ran without error.

You have done your typical thinking ouside of the box.
 
Last edited:
Good point ChrisO. One thing though that makes me believe we can make controls unique on a continuos form is the simple fact that if you put a command button on one and have a few records. Click on that button. Does all of the buttons press down when you do this? No. So even though their code may be shared or even the properties I believe there is some underlying seperation somewhere.

Anyway thanks again all and I'll post a solution if I figure it out and again ChrisO your awsome man and thanks for thinking outside of the box.
 
One thing though that makes me believe we can make controls unique on a continuos form is the simple fact that if you put a command button on one and have a few records. Click on that button. Does all of the buttons press down when you do this? No.

What happens inside Access and what is exposed to the programming interface are two quite separate things.

Good luck finding a hack though. Many things have been invented by someone pushing the envelope. It will certainly make you an icon of the Access community if you manage to do it.
 
By no means with “negative waves” but I don’t think you will be able to find a way to do it in a normal Access Continuous Forms (ACF). I mean that in a positive sense because a lot of time can be wasted on looking for something which doesn’t exist.

If it existed then someone would know about it. And if someone knew about it, it would almost certainly be on Stephen Lebans site. It’s not.

There are some things we can do with ACFs but they are rare and, as far as I know, always bound to the data in the specific record with the focus.

And that could also apply to conditional formatting. If, for instance, the data in the recordset of a Form changed would conditional formatting cause a change in all records? It might be easy to answer that question with a yes but I think the real answer is no. ACFs might have 200,000 records and it would not seem logical to me to try to apply formatting to all the records. To me, it would seem more logical to only apply formatting to the visible records, perhaps 50. We could ask that point as a question; what would be the point of formatting something we can not see?

We may even come to the conclusion that records in an ACF do not contain controls at all but rather images of controls. The only record which contains controls is the record with the focus. If we look at it that way we might start to see what happens with a command button. When we click on a button on an ACF the first thing which happens is the record gets the focus. When the record gets the focus the images are converted back to controls. The button which is clicked then behaves like a button. The other images of that button are not updated because there is no point in doing so.

And the same goes for text boxes on an ACF. We can not enter data into a text box until that text box has the focus. Prior to the text box getting the focus the record gets the focus. The record getting the focus converts the image of the text box to a real text box.

So it could be asked; if we change a property of a control on an ACF then why are all the images of that control changed? The answer to that question might simply be that that is the way Microsoft does it.

----------

If we want something different we write it ourselves, fun and games…

Multiple subform controls are good. The subform control contains a Form and that Form contains a Class module. The Form in that subform is not ‘Opened’ in the normal sense, it is instantiated. When the Form is instantiated so to is its Class module. Each instance of the instantiated Form is a separate entity and can behave differently under program control.

And that is what was used in the demo I posted. In that demo there are three records each handled by a different subform control containing an instantiation of the same Form. There is only one Form, with its Class module, which is required for all records. And because there is only one Form and Class module that only requires writing it in one place.

For some idea of instantiating subforms, up to about 50 with the same Form, look here:-
http://www.access-programmers.co.uk/forums/showthread.php?t=226352

It is not well understood that Forms in subform controls are instantiated and, as such, are not ‘Opened’ but are separate entities. People become wise after the fact.

----------

But I hear “negative waves”; if we have 200,000 records we would need 200,000 subform controls.

No, and for the same reason I think Microsoft didn’t do it that way. We only need as many subform controls as we can fit into view on screen, probably 50 at the very most. And for the sort of thing we are talking about here, less than 15.

----------

To push forward…
The challenge is not how to do it with subform controls. Nor is it to do with the Form in that control.

The challenge is to do with managing the records displayed within those subform controls. The first record displayed, the number of records to display and how we navigate the total number of records to display.

So, on a positive note, I think that is where the time should be spent.
Managing the records and not trying to find something which might not exist.

Chris.
 
The challenge is to do with managing the records displayed within those subform controls. The first record displayed, the number of records to display and how we navigate the total number of records to display.

Chris. An excellent analysis of the crux of the issue. I liked your perspective on the way Continuous Forms work.

The connection between the visible subforms control instances and what they each display is certainly the key.
 
ChrisO thanks again for the perspective. I doubt I will spend a ton of time on it but I'm still a little curious to find out if it is in fact just a painting routine but initing subforms on a form is a great idea. I would imagine to mostly make it complete someone would need to possibly tap into the scroll bar or just use some command buttons that act like a scroll bar to go through the records with maybe some type of search option as well.

Thanks everyone for your thoughts and input. Hopefully this question and answers has helped many other developers understand as well.
 
Well, this was fun….

I think I’ll have to call this Grouped Forms rather than Continuous Forms. Anyway what it amounts to is one subform per record and in this case that means 8 subforms.

Of course there can be more than 8 records; it’s just that only 8 are visible at any one time. That also reduces the code processing to 8 instances which, in this case, there is a lot. (I do mean a lot.)

Each record (subform) contains a drag, drop, resize and save facility. It also contains a pie chart draw facility to graphically show a range of numbers between 0 and 1. It uses Stephen Lebans clsPictureBox as a drawing surface for the record (subform). I did the pie chart so you can’t blame Stephen for that. The pie is drawn from 0 to 1 starting at 12 o’clock and running clockwise in degrees. Draw values are clamped from 0 to 1 so if you enter 75 it will be interpreted as 0.75 of 360 degrees rotation. There is also a slider for entering the rotation data. The slider, and its update on screen, is surprisingly fast.

I have only tested this on XP+Access2003. If it doesn’t work on later versions then there is a service pack for that. It’s called XP+Access2003.

Chris.
 

Attachments

I have only tested this on XP+Access2003. If it doesn’t work on later versions then there is a service pack for that. It’s called XP+Access2003.

ROTFLMAO

You are so right.

Most companies load the latest version without doing their Due Diligence. Some big company is going to come unstuck because of this.

They do not test. A foolish mistake.
 
Extremely nice example of what we can do with initing subforms and I enjoyed the scroll bar. I also had to laugh about the XP service pack statement :D

Glad we are having some fun with Access instead of doing the same old thing everyday :D
 
Hi, and thanks Chris, I love your slider bar control. I was wondering if anyone can help me with it as I'd like to incorporate into a form and need some more control. I've got a bunch of questions, and would appreciate some guidance. In no particular order, here they are. The app has grown, so I'd have to strip out the form and some tables if you need a sample database. I'd also be happy to pay someone who can work with this thing. It's a bit more complex than I'm used to, and I'm under a time crunch.

1. How could I bind the control to a value in a text box on the form so when the form is opened, it's set to that value.

2. I figured out how to set the tick marks to any arbitrary value, along with the hi and lo all via values in fields/text boxes on the form. But, can anyone suggest a way to force it to jump to increments only given any lo value, high value and number of increments?

3. I would like to get control of the image of the slider itself (green up arrow) and size it larger since I'm developing for a touch screen tablet with a small screen.

Again, any help or guidance or referrals would be appreciated.
 
Claude.

I deleted your other post on this matter, it was a duplicate.

I do not think you are referring to the download available in this thread, least I hope not. It is too complicated and the screen real estate would not allow for an increase in size of the slider. That’s the reason I didn’t display the tick marks in that demo.

So I’m thinking you are referring to the slider in this post which does have the tick marks:-
http://www.access-programmers.co.uk/forums/showthread.php?t=225855

And to the questions…

1. How could I bind the control to a value in a text box on the form so when the form is opened, it's set to that value.

The slider has a property which sets its initial value:
.Item(udc.Keys.INIT_VALUE) = 90
Replace 90 with a reference to the text box.

----------

2. I figured out how to set the tick marks to any arbitrary value, along with the hi and lo all via values in fields/text boxes on the form. But, can anyone suggest a way to force it to jump to increments only given any lo value, high value and number of increments?

I changed the code to jump to the nearest tick mark:
dblEngineeringValue = CalcInc(dblEngineeringValue, (dblMaxRange - dblMinRange) / lngNumTicks)
where CalcInc() is a function in the included attachment.

The original slider code called the parent form to display its value. I also changed that code, in the parent form, to call back to the slider to position the image. Note that the call back to the slider must block any call to the parent form else you get into a circular call. Again, please refer to the included attachment.

----------

3. I would like to get control of the image of the slider itself (green up arrow) and size it larger since I'm developing for a touch screen tablet with a small screen.

The slider is drawn in relative size depending on the value of:-
.Add udc.Keys.MARGIN, 25
I changed 25 to 50 to double the size of the slider.

I don’t know what screen size you will be using and I don’t know how far that value can be taken.

----------

New resized demo with snap to tick is attached.

Chris.
 

Attachments

Thank you Chris, I appreciate your help. After 20 years, I find that every time I start thinking I'm getting pretty good, someone like you comes along to humble me. This is going to be very useful in the "touch-screen" app I'm working on for Win 8 tablets. It's very frustrating that Microsoft pushed this alien OS out with no way to revert it's GUI to Win 7 Classic. Things like your slider bar will help since they're easily manipulated by hand. But, while I can make buttons, text boxes and fonts large, there are some small things, such as the drop-down arrow on a list box that cannot be easily changed to a larger size.

There are workarounds. For example, I use Peter's Softwares' shrinker-stretcher code in my main application (desktop) and theoretically, I could use it to here. However, it's a very "heavy" app with more code "overhead" than I'd like to impose on the dinky Atom processors in the typical Win 8 slate.

Well, thanks again! I'll post some screen shots here when it's completed with your slider-bar incorporated.
 
Hi Again, Just an update - currently the form with the slider control subform is getting more useful by the day.

I've got a type mismatch error 13 on initial opening in function SetReturnValue, but it seems to work fine anyway. I do have a question, forgive my lack of expertise as perhaps the reason is obvious. I noticed the sample database has no error trapping and this seems to be common with sample code. Personally, I can't work efficiently without error trapping and this is especially true with complex code someone else wrote. I invariable end up putting in simple error trapping that debug.prints the error number and description. So, the question is why are complex sample databases often devoid of error trapping, or to put another way, what am I missing?
 

Users who are viewing this thread

Back
Top Bottom