473,387 Members | 1,520 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,387 software developers and data experts.

Amateur would like code critique

MS
I'm strictly an amteur. Self taught via the help files.

Here is an example of a DB I've done. It is quite simple to some of the ones
I do for my workplace, but it is an example of the way i work. I have
received enormous help from this NG over the years, and I was wondering if
you experts could have a look and see how I'm doing, and if I'm doing
anything blatantly silly.

This app is to quickly calculate the cost of transport around Australia by a
particular courier company from a particular deaparture point.

Thanks in advance.

Cheers to all!
http://members.ozemail.com.au/~tma1/...terExpress.zip
Nov 13 '05 #1
4 1270
Looks like it does the job that it was intended to do, and that should
be a major evaluation criteria. Keep up the good work!

There are a couple things you could do differently:

1. Get in the habit of:
Dim rst as DAO.Recordset
instead of
Dim rst as Recordset

If you ever work on a system with both DAO and ADO, you will find that
removing the ambiguity is vital.

2. Why did you put your Calculate procedure in a separate module? It
could easily work within the form's code module. Doing so would
simplify some of your code -- easier to refer to various controls from
within the form's code module.

3. You have several procedures with exactly the same functionality
e.g. TxtPC_GotFocus, TxtPC_Click, and TxtHt_Click. Once I see a
repetetive code section, I try to place it into a single procedure
that is called from several locations, using parameters.
HTH
On Thu, 07 Jul 2005 03:01:55 GMT, "MS" <Em***@Myemail.com> wrote:
I'm strictly an amteur. Self taught via the help files.

Here is an example of a DB I've done. It is quite simple to some of the ones
I do for my workplace, but it is an example of the way i work. I have
received enormous help from this NG over the years, and I was wondering if
you experts could have a look and see how I'm doing, and if I'm doing
anything blatantly silly.

This app is to quickly calculate the cost of transport around Australia by a
particular courier company from a particular deaparture point.

Thanks in advance.

Cheers to all!
http://members.ozemail.com.au/~tma1/...terExpress.zip

**********************
ja**************@telusTELUS.net
remove uppercase letters for true email
http://www.geocities.com/jacksonmacd/ for info on MS Access security
Nov 13 '05 #2
MS

"Jack MacDonald" <ja**************@telus.net> wrote in message
news:uq********************************@4ax.com...
Looks like it does the job that it was intended to do, and that should
be a major evaluation criteria. Keep up the good work!

There are a couple things you could do differently:

1. Get in the habit of:
Dim rst as DAO.Recordset
instead of
Dim rst as Recordset

If you ever work on a system with both DAO and ADO, you will find that
removing the ambiguity is vital.

2. Why did you put your Calculate procedure in a separate module? It
could easily work within the form's code module. Doing so would
simplify some of your code -- easier to refer to various controls from
within the form's code module.

3. You have several procedures with exactly the same functionality
e.g. TxtPC_GotFocus, TxtPC_Click, and TxtHt_Click. Once I see a
repetetive code section, I try to place it into a single procedure
that is called from several locations, using parameters.

Thanks for taking the time to have a look!

I'll take on board the suggestions. I often tend to "duplicate" some things
like "Click" and "GotFocus" as I'm not sure that clicking on a control and
tabbing onto it are the same.

As far as the Calculate module being in it's own module, this procedure is
called both when the Calculate button is pushed and when the Destination
Combo is triggered, The reason for this that I wanted the calculation to be
effected after changing the Destination, but if the weight criteria is
changed, I wanted the user to be able to "recalculate" with the new weight.

Calling the procedure from a module meant that if I wanted to change the
formula, I'd only have to do it once.

I'll investigate the differences between DAO and ADO.

Thanks! All the best!
Nov 13 '05 #3
On Fri, 08 Jul 2005 04:30:06 GMT, "MS" <Em***@Myemail.com> wrote:

"Jack MacDonald" <ja**************@telus.net> wrote in message
news:uq********************************@4ax.com.. .
Looks like it does the job that it was intended to do, and that should
be a major evaluation criteria. Keep up the good work!

There are a couple things you could do differently:

1. Get in the habit of:
Dim rst as DAO.Recordset
instead of
Dim rst as Recordset

If you ever work on a system with both DAO and ADO, you will find that
removing the ambiguity is vital.

2. Why did you put your Calculate procedure in a separate module? It
could easily work within the form's code module. Doing so would
simplify some of your code -- easier to refer to various controls from
within the form's code module.

3. You have several procedures with exactly the same functionality
e.g. TxtPC_GotFocus, TxtPC_Click, and TxtHt_Click. Once I see a
repetetive code section, I try to place it into a single procedure
that is called from several locations, using parameters.

Thanks for taking the time to have a look!

I'll take on board the suggestions. I often tend to "duplicate" some things
like "Click" and "GotFocus" as I'm not sure that clicking on a control and
tabbing onto it are the same.


Nothing wrong with that strategy, and it goes towards my point. You
make a *common* procedure in your form's class module, and call that
procedure from *both* events. That way, you don't duplicate the code.


As far as the Calculate module being in it's own module, this procedure is
called both when the Calculate button is pushed and when the Destination
Combo is triggered, The reason for this that I wanted the calculation to be
effected after changing the Destination, but if the weight criteria is
changed, I wanted the user to be able to "recalculate" with the new weight.

Calling the procedure from a module meant that if I wanted to change the
formula, I'd only have to do it once.
My point exactly... Perhaps you are unaware that you can put
procedures in the form's code in addition to the event procedures for
the controls??? Something like this
Sub txtButton_click
doStuff
end sub

sub cboWhatever_afterupdate
doStuff
end sub

sub doStuff()
... a bunch of commands
end sub
I would put the procedure into a separate module *only* if it was
required to be called from two different forms.


I'll investigate the differences between DAO and ADO.

Thanks! All the best!

**********************
ja**************@telusTELUS.net
remove uppercase letters for true email
http://www.geocities.com/jacksonmacd/ for info on MS Access security
Nov 13 '05 #4
MS

"Jack MacDonald" <ja**************@telus.net> wrote in message
news:tq********************************@4ax.com...
On Fri, 08 Jul 2005 04:30:06 GMT, "MS" <Em***@Myemail.com> wrote:

"Jack MacDonald" <ja**************@telus.net> wrote in message
news:uq********************************@4ax.com. ..
Looks like it does the job that it was intended to do, and that should
be a major evaluation criteria. Keep up the good work!

There are a couple things you could do differently:

1. Get in the habit of:
Dim rst as DAO.Recordset
instead of
Dim rst as Recordset

If you ever work on a system with both DAO and ADO, you will find that
removing the ambiguity is vital.

2. Why did you put your Calculate procedure in a separate module? It
could easily work within the form's code module. Doing so would
simplify some of your code -- easier to refer to various controls from
within the form's code module.

3. You have several procedures with exactly the same functionality
e.g. TxtPC_GotFocus, TxtPC_Click, and TxtHt_Click. Once I see a
repetetive code section, I try to place it into a single procedure
that is called from several locations, using parameters.

Thanks for taking the time to have a look!

I'll take on board the suggestions. I often tend to "duplicate" some
things
like "Click" and "GotFocus" as I'm not sure that clicking on a control and
tabbing onto it are the same.


Nothing wrong with that strategy, and it goes towards my point. You
make a *common* procedure in your form's class module, and call that
procedure from *both* events. That way, you don't duplicate the code.


As far as the Calculate module being in it's own module, this procedure is
called both when the Calculate button is pushed and when the Destination
Combo is triggered, The reason for this that I wanted the calculation to
be
effected after changing the Destination, but if the weight criteria is
changed, I wanted the user to be able to "recalculate" with the new
weight.

Calling the procedure from a module meant that if I wanted to change the
formula, I'd only have to do it once.


My point exactly... Perhaps you are unaware that you can put
procedures in the form's code in addition to the event procedures for
the controls??? Something like this
Sub txtButton_click
doStuff
end sub

sub cboWhatever_afterupdate
doStuff
end sub

sub doStuff()
... a bunch of commands
end sub
I would put the procedure into a separate module *only* if it was
required to be called from two different forms.

Of course! That's the way I've done it in the past - is more logical! Thanks
Nov 13 '05 #5

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

Similar topics

12
by: hokiegal99 | last post by:
Is there a forum where one could post a Python script and have it critiqued by others? Something like: Y would be more efficent if you did it this way, or doing it that way could cause problems...
37
by: Eric | last post by:
There is a VB.NET critique on the following page: http://www.vb7-critique.741.com/ for those who are interested. Feel free to take a look and share your thoughts. Cheers, Eric. Ps: for those...
19
by: TC | last post by:
Are there any good sites or forums for a web critique? I went to alt.html.critique and it's pretty dead.
9
by: bowsayge | last post by:
Inspired by fb, Bowsayge decided to write a decimal integer to binary string converter. Perhaps some of the experienced C programmers here can critique it. It allocates probably way too much...
8
by: G Patel | last post by:
I wrote the following program to remove C89 type comments from stdin and send it to stdout (as per exercise in K&R2) and it works but I was hoping more experienced programmer would critique the...
188
by: christopher diggins | last post by:
I have posted a C# critique at http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up the following issues : - unsafe code - attributes - garbage collection -...
11
by: ymic8 | last post by:
Hi everyone, this is my first thread coz I just joined. Does anyone know how to crawl a particular URL using Python? I tried to build a breadth-first sort of crawler but have little success. ...
2
by: winston | last post by:
I wrote a Python program (103 lines, below) to download developer data from SourceForge for research about social networks. Please critique the code and let me know how to improve it. An...
2
by: matt | last post by:
this is my first program in this language ever (besides 'hello world'), can i get a code critique, please? it's purpose is to read through an input file character by character and tally the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.