Toolbars at Startup

G

Guy S

I have read the article about un-checking the "Allow built-in toolbars"
option in the startup options window.
I have developed custom toolbars for my forms and reports.
However, when I run a query, I do no longer have a toolbar available.
How can the standard toolbar or a custom toolbar be dispalyed when running a
query?

Thanks for your help
 
G

Guy S

I usually use forms or reports for the applications I distribute.
However, occasionally I need to run a one-time query to analyze my data, and
I do not want to create a new form or report each time.
I don't even have to save the query after I look at the data

Also, crosstab queries that do not have a fixed number of columns cannot be
converted into forms. The only easy way I know to look at these is in query
mode.
 
G

Guy S

Steve:

Thanks for the help.
I can probably find some workarounds as you suggested.

As to my initial question, is it YES (and How) or NO, possible to have a
custom or standard toolbar with a query, once the checkbox "Allow buil-in
toolbars" has been canceled.

I would also be interested in how you can create a form based on a crosstab
query where the number of columns can change.

Thanks
 
D

Douglas J. Steele

Steve said:
Create a basic form based on a crosstab query and programatically use the
the CreateControl function to create any additional controls on the open
basic form.

That's a terrible suggestion, Steve! Most people prefer to distribute their
front-end databases as MDEs, so that's a non-started in that case. And even
if the front-end isn't an MDE, you'd end up with each user potentially
having a different version of the form. CreateControl is intended for
wizard-like interfaces, not for production forms.

Better would be to know in advance a maximum number of possible fields in
the crosstab query, and add them, unbound, to the form. Once the form is
open, you'd check how many fields actually exist in the recordsource, then
bind them to the appropriate controls in the form, leaving the Visible
property of the remaining unused controls set to False.

Another option, of course, is to construct the crosstab query so that it
always returns a fixed number of fields (by using an IN clause for the PIVOT
statement in the query). Again, you can control the visibility of any
unnecessary controls.
 
P

Petr Danes

Hi Steve,

Doug is right, that's a bad idea. I built an app doing exactly that
recently, and discovered the hard way what I might have learned if I had
thought to scan the NG archives first. It just didn't occur to me that there
might be a problem with doing that.

The basic problem with the whole concept is that a form has a limited number
of controls that can be created over its entire lifetime. I was building a
form that scanned a table and created checkboxes for subsequent searches,
based on the contents of the table. Fortunately, I was deleting and
re-creating lots of controls, so the problem surfaced fairly quickly and
after discovering what was wrong, I went to a different approach with little
time lost. But if you or Guy make a form that does that, sooner or later the
form will crash with the "Unable to create control" error. I forget the
number, but if you look through the archives, you will find numerous
references to this problem. I don't remember now if Compact and Repair
resets this, so that you can add more controls again, but it's not something
you would want a user to have to do in any case.

My final version works similarly to what Doug suggested, create the maximum
number of controls once and make visible only those you need. (I don't bind
mine, but that's a detail.) I change the caption of the associated label and
the form now works beautifully, and as an added benefit, runs a good bit
faster - CreateControl is a fairly slow piece of code, but changing the
visible property and text in a caption is immediate.

Petr
 
G

Guy S

To All the responders;

Thank you all for the help and lively discussion.
I have to digest all this now, and I am sure there is everything i need in
the responses.

Guy S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top