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

Is it generally considered good practice to ...

MLH
I have frmMainMenu with the following two code
lines invoked on a button click...

2420 DoCmd.OpenForm "frmVehicleEntryForm", A_NORMAL, , , A_ADD,
A_NORMAL
2440 DoCmd.GoToRecord , , A_NEWREC

Is it generally considered good practice to issue the command
in line #2440 - intended to go to a new record in the vehicle entry
form - from frmMainMenu?

BTW, frmVehicleEntryForm's AllowEdits, AllowDeletions, AllowAdditions
and DataEntry property settings are all Yes. Does line #2440 even need
to be executed?
May 8 '07 #1
6 2535
"MLH" <CR**@NorthState.netwrote
>I have frmMainMenu with the following two code
lines invoked on a button click...

2420 DoCmd.OpenForm "frmVehicleEntryForm", A_NORMAL, , , A_ADD,
A_NORMAL
2440 DoCmd.GoToRecord , , A_NEWREC

Is it generally considered good practice to issue the command
in line #2440 - intended to go to a new record in the vehicle entry
form - from frmMainMenu?
You have specified in the OpenForm that it is to be opened in DataEntry mode
with the "A_ADD", which will override the actual Form properties, so there
is no need. In my not-so-humble opinion, redundant code is not "good
practice" unless it is _necessary_ to understanding for someone reading the
code, later.

However, code will continue to be executed, and, in my experience, the
OpenForm will have been completed, so that the GoToRecord will apply to the
newly opened form which will be the active form (that is, the one with the
Focus), even if you have not specified opening in Data Entry mode. You are
relying on the newly opened Form being the active Form, but that is the case
with the code you show, and will continue to be the case barring some design
change to Access itself.

All that said, the constants you are using are from Access 1.0 - Access 2.0
days, but the format of the DoCmd.OpenForm is of more recent vintage (in
Access 2.0, it would be DoCmd OpenForm...). But just in case, you _were_
asking about Access 2.0, I do not have that version readily available to
test, but think the answers are the same.

And, as an aside, for anyone asking about a version as far from being
current as Access 2.0 now is, it is a Really Good Idea to mention the
version. In fact, given all the "dramatic" changes in Access 2007, it is
probably more important than ever to identify the version that you are
using.
BTW, frmVehicleEntryForm's AllowEdits,
AllowDeletions, AllowAdditions and DataEntry
property settings are all Yes. Does line #2440
even need to be executed?
No, it does not, as discussed above.

Larry Linson
Microsoft Access MVP
May 8 '07 #2
MLH
On Tue, 08 May 2007 17:25:16 GMT, "Larry Linson"
<bo*****@localhost.notwrote:
>"MLH" <CR**@NorthState.netwrote
>>I have frmMainMenu with the following two code
lines invoked on a button click...

2420 DoCmd.OpenForm "frmVehicleEntryForm", A_NORMAL, , , A_ADD,
A_NORMAL
2440 DoCmd.GoToRecord , , A_NEWREC

Is it generally considered good practice to issue the command
in line #2440 - intended to go to a new record in the vehicle entry
form - from frmMainMenu?

You have specified in the OpenForm that it is to be opened in DataEntry mode
with the "A_ADD", which will override the actual Form properties, so there
is no need. In my not-so-humble opinion, redundant code is not "good
practice" unless it is _necessary_ to understanding for someone reading the
code, later.
Thank-you.
>
However, code will continue to be executed, and, in my experience, the
OpenForm will have been completed, so that the GoToRecord will apply to the
newly opened form which will be the active form (that is, the one with the
Focus), even if you have not specified opening in Data Entry mode. You are
relying on the newly opened Form being the active Form, but that is the case
with the code you show, and will continue to be the case barring some design
change to Access itself.
Thx for that. 'tis reassuring to know that's the case.
>
All that said, the constants you are using are from Access 1.0 - Access 2.0
days, but the format of the DoCmd.OpenForm is of more recent vintage (in
Access 2.0, it would be DoCmd OpenForm...). But just in case, you _were_
asking about Access 2.0, I do not have that version readily available to
test, but think the answers are the same.
I agree with you on that. I've been getting by on a bit of luck.
?a_add
0
?acFormAdd
0
?acnormal
0
?a_normal
0
Where it gets unlucky is when I post code here with the old 1.0 and
2.0 constants in it. It can lend confusion to my question. Thx 4 the
'heads up' on that topic. Do you think I could go wrong with a global
search 'n replace in forms & modules substituting acFormAdd for A_Add?
>
And, as an aside, for anyone asking about a version as far from being
current as Access 2.0 now is, it is a Really Good Idea to mention the
version. In fact, given all the "dramatic" changes in Access 2007, it is
probably more important than ever to identify the version that you are
using.
Absolutely. I failed to mention that I was working in A97. And using
1.0 / 2.0 references therein - well, that was just more crumming icing
on the cake.
>
BTW, frmVehicleEntryForm's AllowEdits,
AllowDeletions, AllowAdditions and DataEntry
property settings are all Yes. Does line #2440
even need to be executed?

No, it does not, as discussed above.

Larry Linson
Microsoft Access MVP
May 8 '07 #3
Larry Linson wrote:
All that said, the constants you are using are from Access 1.0 - Access 2.0
days, but the format of the DoCmd.OpenForm is of more recent vintage (in
Access 2.0, it would be DoCmd OpenForm...).
Does the guy even realize that intellisense will prompt you for the
correct constants?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
May 8 '07 #4
"MLH" <CR**@NorthState.netwrote
. . . Do you think I could go wrong with a global
search 'n replace in forms & modules substituting
acFormAdd for A_Add?
To me, the meanings are obvious, even with the Access 2.0 constants. I
probably wouldn't bother to change them, as long as Access supports them for
backward compatibility.

I'd certainly use the current constants when I write a new statement, and,
as Tim Marshall pointed out, Intellisense will show you the options. But, of
course, you don't get that "assistance" when you convert older code to the
current version, as you apparently did from Access 2.0 to Access 97.

And, yes, if you use a mixture of old and new formats, there are some who
might complain about "consistency", but, as long as it doesn't affect the
readability of the code, I wouldn't worry.

Larry Linson
Microsoft Access MVP
>>And, as an aside, for anyone asking about a version as far from being
current as Access 2.0 now is, it is a Really Good Idea to mention the
version. In fact, given all the "dramatic" changes in Access 2007, it is
probably more important than ever to identify the version that you are
using.
Absolutely. I failed to mention that I was working in A97. And using
1.0 / 2.0 references therein - well, that was just more crumming icing
on the cake.
>>
BTW, frmVehicleEntryForm's AllowEdits,
AllowDeletions, AllowAdditions and DataEntry
property settings are all Yes. Does line #2440
even need to be executed?

No, it does not, as discussed above.

Larry Linson
Microsoft Access MVP

May 8 '07 #5
MLH
All good suggestions. Thanks.
>
To me, the meanings are obvious, even with the Access 2.0 constants. I
probably wouldn't bother to change them, as long as Access supports them for
backward compatibility.

I'd certainly use the current constants when I write a new statement, and,
as Tim Marshall pointed out, Intellisense will show you the options. But, of
course, you don't get that "assistance" when you convert older code to the
current version, as you apparently did from Access 2.0 to Access 97.

And, yes, if you use a mixture of old and new formats, there are some who
might complain about "consistency", but, as long as it doesn't affect the
readability of the code, I wouldn't worry.
May 9 '07 #6
MLH
Yep, the guy realizes that. But the guy
doesn't always follow good advice because
he's a stubborn old fart insistent on learning
things the hard way. (sorry)
May 9 '07 #7

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

Similar topics

24
by: matty | last post by:
Go away for a few days and you miss it all... A few opinions... Programming is a craft more than an art (software engineering, not black magic) and as such, is about writing code that works,...
52
by: Tony Marston | last post by:
Several months ago I started a thread with the title "What is/is not considered to be good OO programming" which started a long and interesting discussion. I have condensed the arguments into a...
61
by: Steven T. Hatton | last post by:
Stroustrup's view on classes, for the most part, seems to be centered around the notion of invariants. After a bit of adjusting to the use of yamt (yet another math term) in computer science, I...
13
by: Peteroid | last post by:
Why does reading a member of a std::map not considered const? For example: class My_Class { int Get_Map_Value( int index ) const // ** error ** not considered const!!! { return m_Map ; //...
1
by: trebor | last post by:
I'm learning dotNet, although I first learned programming back in the days when structured programming was all the rage. In both my books and courses, I've seen something like this: Public Class...
150
by: tony | last post by:
If you have any PHP scripts which will not work in the current releases due to breaks in backwards compatibility then take a look at http://www.tonymarston.net/php-mysql/bc-is-everything.html and...
13
by: Sameer | last post by:
Hi friends, I am beginner in C++. I am using g++ compiler. below is my code which gives error as " invlid conversion from 'char' to 'const char*' ..Plz help me with this. #include <iostream.h>...
15
by: Bob Alston | last post by:
Is it considered best practice to distribute FE databases as MDEs rather than MDBs? Without flaming me for asking the question, could someone please enumerate the key advantages? Also I like to...
17
by: Harry George | last post by:
....at least around here. I run a corporate Open Source Software Toolkit, which makes hundreds of libraries and apps available to thousands of technical employees. The rules are that a) a very...
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: 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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
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.