473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Query Documenting Code

I have a ton of queries that I need users to be able to view. I'd like to
have them viewed in a datasheet-view form instead of directly, so that I can
keep the users from futzing with the data.

I'd like to do this in a temporary database, creating an autoform based on
the query and making that form the source object for a subform in a
pre-existing main form. I just ran a quick-and-dirty test, using the code at
the bottom of this post, and it seems to work reasonably well (the client
doesn't have much money to spend, so reasonably well is good enough, or will
be once I tweak the code and nudge the main form).

I'm using Call DoCmd.RunCommand(acCmdNewObjectAutoForm) to create the form.
It works fine, as long as I've got the query highlighted in the database
window. Is there a way to supply a query name for this wizard? Or is there a
way to control what's highlighted in the database window?

Many thanks for any pointers.

Jeremy

--

Sub MakeTheForm()
Call DoCmd.DeleteObject(acForm, "Form1")
Call DoCmd.RunCommand(acCmdNewObjectAutoForm)
Call DoCmd.Save
Forms!form1.AllowEdits = False
Forms!form1.AllowAdditions = False
Forms!form1.AllowDeletions = False
Call DoCmd.OpenForm("form1", acDesign)
Forms!form1.DefaultView = 2 'datasheet
Call DoCmd.Save
Call DoCmd.Close(acForm, "Form1")
Call DoCmd.OpenForm("frmTempMain")
Forms!frmMain.SetFocus
End Sub

=================
Jeremy Wallace
AlphaBet City Dataworks
ABCDataworks dot com
Nov 12 '05 #1
6 2859
Just wondering if this might help... any way you could tweak the code
in the SQL section of the Developer Handbook... just pick a query from
a dropdown or something and then have it show in the bottom window as
read only?
Nov 12 '05 #2
rkc

"Jeremy Wallace" <cd**@abcdataworks.SKIPTHISPART.com> wrote in message
news:bF********************@speakeasy.net...
I have a ton of queries that I need users to be able to view. I'd like to
have them viewed in a datasheet-view form instead of directly, so that I can keep the users from futzing with the data.

I'd like to do this in a temporary database, creating an autoform based on
the query and making that form the source object for a subform in a
pre-existing main form. I just ran a quick-and-dirty test, using the code at the bottom of this post, and it seems to work reasonably well (the client
doesn't have much money to spend, so reasonably well is good enough, or will be once I tweak the code and nudge the main form).


Don't know the answer to your question, but I think I would look
at using a simple ListBox and set it's properties to match each query
you want to view. Lighter weight widget, no need to re-create a
subform each time.
Nov 12 '05 #3
rk*@yabba.dabba.do.rochester.rr.bomb (rkc) wrote in
<S_*******************@twister.nyroc.rr.com>:

"Jeremy Wallace" <cd**@abcdataworks.SKIPTHISPART.com> wrote in
message news:bF********************@speakeasy.net...
I have a ton of queries that I need users to be able to view.
I'd like to have them viewed in a datasheet-view form instead of
directly, so that I

can
keep the users from futzing with the data.

I'd like to do this in a temporary database, creating an
autoform based on the query and making that form the source
object for a subform in a pre-existing main form. I just ran a
quick-and-dirty test, using the code

at
the bottom of this post, and it seems to work reasonably well
(the client doesn't have much money to spend, so reasonably well
is good enough, or

will
be once I tweak the code and nudge the main form).


Don't know the answer to your question, but I think I would look
at using a simple ListBox and set it's properties to match each
query you want to view. Lighter weight widget, no need to
re-create a subform each time.


Interesting suggestion.

I once had an application that had way too many fields in the
tables (design error on my part), and I needed forms that would
allow editing of all the data. I already had forms for the three
main tables, but didn't want to create three other complex forms
that combined the data from those three tables with the data from
the 1:1 data tables that were not part of the data entry process
(the records were partly created from an import process and partly
from data entry). So I used a listbox populated by a function and
allowed editing via a text box at the top of the form. You could
edit the value of the particular row of the listbox, where each row
was a field from a particular record (each record being combined
from two 1:1 tables).

It was pretty complex, but it did mean that I got a single form
that allowed viewing and editing of all the data in the
application. I'm not certain it was easier than hand-building the
forms would have been, but in terms of maintenance it was much
easier. Six months after I implemented this, the organization where
the data originate restructured their data tables in minor ways and
adapting this form to deal with that was as easy as editing a few
rows in the the data tables that I used to help with the UI (I got
user-friendly descriptions of the fields from this data table, for
instance, and also used it to control which fields were editable
and which were not).

I've often thought about trying to put together a demo from it, but
it's so application-specific that I don't think it's worth it.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #4
rkc

"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:94***************************@24.168.128.78.. .
rk*@yabba.dabba.do.rochester.rr.bomb (rkc) wrote in
<S_*******************@twister.nyroc.rr.com>:

Don't know the answer to your question, but I think I would look
at using a simple ListBox and set it's properties to match each
query you want to view. Lighter weight widget, no need to
re-create a subform each time.


Interesting suggestion.

I once had an application that had way too many fields in the
tables (design error on my part), and I needed forms that would
allow editing of all the data. I already had forms for the three
main tables, but didn't want to create three other complex forms
that combined the data from those three tables with the data from
the 1:1 data tables that were not part of the data entry process
(the records were partly created from an import process and partly
from data entry). So I used a listbox populated by a function and
allowed editing via a text box at the top of the form. You could
edit the value of the particular row of the listbox, where each row
was a field from a particular record (each record being combined
from two 1:1 tables).

It was pretty complex, but it did mean that I got a single form
that allowed viewing and editing of all the data in the
application. I'm not certain it was easier than hand-building the
forms would have been, but in terms of maintenance it was much
easier.


What the op was asking for isn't nearly as complex as what you were
doing. If all that is wanted is to display the result of a saved query,
the whole deal can be accomplished in about ten lines of code. The
only thing that needs to be done besides setting 4 listbox properties
is to determine the field count. That can be done via the querydef
object. The only thing a read only datasheet has to offer over a
listbox is the built in column sorting. Which admittedly is a big thing
if it's desired.


Nov 12 '05 #5
Pieter,

Thanks. I had completely forgotten about that form. I remember how long it
took me to digest what was going on in that form, but then, that was back in
1996 or 1997.

I dropped it in my database, added the combo box from my sql editior form
and it didn't work right away. I'll tweak it a bit and see how it goes. I
don't imagine any major problems. I'm sure this will save me tons of work,
and do exactly what I'm looking for.

Thanks again.

Jeremy

--
=================
Jeremy Wallace
AlphaBet City Dataworks
ABCDataworks dot com
"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
Just wondering if this might help... any way you could tweak the code
in the SQL section of the Developer Handbook... just pick a query from
a dropdown or something and then have it show in the bottom window as
read only?

Nov 12 '05 #6
Just had to change the form references to function calls in the
queries and then everything's hunky dory.

Thanks again for showing the light.

"Jeremy Wallace" <cd**@abcdataworks.SKIPTHISPART.com> wrote in message news:<MR********************@speakeasy.net>...
Pieter,

Thanks. I had completely forgotten about that form. I remember how long it
took me to digest what was going on in that form, but then, that was back in
1996 or 1997.

I dropped it in my database, added the combo box from my sql editior form
and it didn't work right away. I'll tweak it a bit and see how it goes. I
don't imagine any major problems. I'm sure this will save me tons of work,
and do exactly what I'm looking for.

Thanks again.

Jeremy

--
=================
Jeremy Wallace
AlphaBet City Dataworks
ABCDataworks dot com
"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
Just wondering if this might help... any way you could tweak the code
in the SQL section of the Developer Handbook... just pick a query from
a dropdown or something and then have it show in the bottom window as
read only?

Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Isaac Rodriguez | last post by:
Hi, Are there any standarized ways of documenting Python code? When I check the __doc__ attribute of the standard modules, the results are kind of plain. Is everyone using this style? Since...
2
by: Lasse Vågsæther Karlsen | last post by:
I notice that if I use this syntax: def classname: ... ## # closes the database connection and releases the resources. def close(self): .... ##
17
by: Jelmer | last post by:
Hi, I am mildly familiar with ms access developement and I have been asked to port and document a ms access app. I expect the porting (97 to XP) to be fairly straightforward. However documenting...
13
by: Jeff Rodriguez | last post by:
What sort of documentation do you do on your code? I've never done any code development on a big project and I want to start documenting my code in a way that makes sense, is easy to understand,...
1
by: Brett | last post by:
I'd like to have all of my documentation in one place. I use the following for documenting code: - attributes for certain types of documentation - use of the C# generated inline XML...
8
by: Spleenwort | last post by:
With regard to XML comments in c#. I think that #regions should be self-documenting relative to XML comments or that a <region> tag should be defined and auto-inserted when you type #region...
30
by: Paul H | last post by:
I seem to end up with loads of append and update queries just because it's quick and easy to build queries or make a new ones based on an existing query. But I end up with loads of queries with...
5
by: Cyrax1033 | last post by:
I have yet a new issue that is the only factor stopping me from adding on the last feature to the database; all help is very much appreciated! In my database is are two tables: one for inserting...
2
by: sajithamol | last post by:
What is a Self Documenting Code? wheather java is a self documenting code?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.