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

background grid for scheduler

Status
Not open for further replies.

SuryaF

Programmer
May 21, 2006
100
DE
Hi everyone,
I'm working on a scheduler and I've been using labels to draw the background grid but I'm using way too many controls and the form is getting very slow.
Any idea what kind of control or method I can use to put that table-like grid in the background?
I'd like to be able to format this grid at runtime (alternate back colors for rows, run-time defined line colors and others).
Any ideas?
Many thanks!
 
As you add and delete controls there is a lot of overhead, so if you are going to put a lot of controls on a form do it in code so that you can start with a fresh form and do just a little bit of editing.
Take a look at thread702-1498416 for an example of building a grid in code.

1) You can use a third party control like a flexgrid
2) Why not a continous form? Looks and acts like a grid. If I want a 10 by 10 grid I will build tblDisplay with 11 fields.

tblDisplay
ID
field1
field2
....
field10

put 10 values in the ID field and display that in a form with allow additions = false and allow deletions = false.
Now use recordsets to write to the "pseudo grid" and read to this pseudo grid.

You can use the key press events to make this act like a grid (i.e. up arrow moves up a cell, right arrow moves right a cell)

 
Thanks MajP.
The problem with a continuous form is that I can't put a control that is on two rows. Imagine each row is a 15 minute interval but I want to show a 30 minute appointment as a distinct block, there's no way I can do that with a continuous form. Makes sense?
I'll look into the flexgrid, I'm curious.
What puzzles me is why as a subform the process takes 1.5 seconds when as a standalone form it takes 0.2 seconds.
Thanks again for taking the time!
 
Yes, that's one way of doing it but it limits the actions you can do and the formatting options. Which is quite necessary for me since I'm building a commercial application that needs to look as non-accessy as possible.

I solved the problem though, I basically recreated the form from scratch just like you suggested, and it worked!
Now I'm wondering how much kr#p is in the forms I'm using. And I have about 1000. And I wonder if I should rebuild all my forms from scratch. I'll post another question in another thread about this.
Thanks again for the help!
 
If you are doing this as an unbound grid with lots of controls then the limit is

754 controls over the lifetime of the form or report

So if you are doing a bunch of adding and deleting you may find that you exceed this limit even if you have far fewer than 754 currently on your form.

 
Are you saying that you have around 1000 forms? Out of curiosity, if that is true can you roughly explain why so many. I can not comprehend that many, but the type of apps I build are data analysis centric not management centric. I would have to think that multiple form instances, dynamic forms, or some other strategy could vastly reduce that number.
 
Hehehe, yes, I have around 1000 forms and probably some of them can be taken out and replaced by dynamic versions but most of them are unique and necessary. It's a lot but it works without issues.
The application is an ERP system for small clinics, fron-end in Access 2003 and back-end in SQL Server.
Now I'm taking it to Access 2007 and trying to increase the speed and everything. Next version will probably be in VB.NET, Access becomes a bit restrictive for this.
 
In case somebody else is looking for a similar solution, I found a more elegant way.
I'm using the FlexGrid control to draw the back grid and on top of it I draw my appointments.

Since Access puts any ActiveX control in front of the other ones, I need to disable the flexgrid. Nonetheless, it's much more elegant, and I can capture the clicks on the grid with a transparent image on top of the grid.

I'm sure there are some other ways but this helps me stay with a normal amount of controls on my form and speeds-up the initial formatting of the grid.

For examples of how to use the flexgrid, I found Peter Hibbs' samples on Roger's Access Library
HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top