473,405 Members | 2,415 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,405 software developers and data experts.

Message - Too many continuation lines

Know somebody out there will laugh a this but i have the following function
that opens a certain form based on the password but because there are so many
forms, i am getting the 'too many continuation lines' message. How can i
rewrite the else if code to overcome this:

Private Sub okbutton_Click()
If Forms![password form].text_password = "atay1" Then DoCmd.OpenForm "Angela
Taylor" _
Else: If Forms![password form].text_password = "dgra15" Then DoCmd.OpenForm
"Dave Graham" _
Else: If Forms![password form].text_password = "fles16" Then DoCmd.OpenForm
"Fred Lester" _
Else: MsgBox "You have entered an incorrect password", vbOKCancel
DoCmd.Close acForm, "password form", acSaveNo
End Sub

(There are another 20+ lines attached to this)
Thanks John

Jun 27 '08 #1
1 1554
Khartoum wrote:
Know somebody out there will laugh a this
No, it's not particularly funny. It makes me sad.
but i have the following function that opens a certain form based on the
password but because there are so many forms, i am getting the 'too many
continuation lines' message. How can i rewrite the else if code to
overcome this:
Use the ElseIf statement and remove the colons and the underscores. There's
no need to squeeze everything on one line. So instead of this:
Private Sub okbutton_Click()
If Forms![password form].text_password = "atay1" Then DoCmd.OpenForm "Angela
Taylor" _
Else: If Forms![password form].text_password = "dgra15" Then DoCmd.OpenForm
"Dave Graham" _
Write this:

If Forms![password form].text_password = "atay1" Then
DoCmd.OpenForm "Angela Taylor"
ElseIf Forms![password form].text_password = "dgra15" Then
DoCmd.OpenForm "Dave Graham"

Since you're checking a single expression, you could use a Select...Case
statement and write this:

Select Forms![password form].text_password
Case "atay1"
DoCmd.OpenForm "Angela Taylor"
Case "dgra15"
DoCmd.OpenForm "Dave Graham"

But actually, don't write that either. Why aren't you storing the passwords
as hashes in a database? This is completely unmaintainable -- every time the
user base changes the code has to change. It's also fairly trivial for
someone to open up your application in Notepad and extract all the
passwords. You don't have to be a master hacker for that.

And if these are the *actual* passwords you're using, you might as well not
bother with passwords at all and have people select their account from a
drop-down list, because they're trivial to guess. This is just pretend-security.

You may want to take a look at the integrated security options for Windows.
This will allow users to use the application without needing a separate
login, as they can just use their Windows account. Take a look at the
Environment.UserName property.

--
J.
http://symbolsprose.blogspot.com
Jun 27 '08 #2

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

Similar topics

2
by: Don Leckie | last post by:
Hi, I've searched all my Java books ans newsgroup archives and found nothing. Once I thought that I saw a character at the end of a line allowed a String literal to span multiple lines. I...
5
by: Sandra-24 | last post by:
I'm not sure how complex this is, I've been brainstorming a little, and I've come up with: If the previous line ended with a comma or a \ (before an optional comment) That's easy to cover...
3
by: Wendy Elizabeth | last post by:
I am writing a vb.net program that needs to create a table in the same format each time it creates a new table. This is a "ulility" program that I am going to be using it for. Right now I have...
2
by: rj_noone962 | last post by:
Hello, I am trying to build a SQL statement dynamically for execution within a procedure, using PREPARE ... OPEN. SET v_sql = ' SELECT a,b,c,d,e, .....x,y,z FROM table1, table2 WHERE a =...
1
by: lophiomys | last post by:
Hi, I have an extra long attribute value, and can't find a way to wrap it over several short lines in my text editor, so that it stays nicely human readable. Is there a line-continuation...
6
by: Haakon Riiser | last post by:
After a long debugging session while scripting my webmail, I believe I have traced the problem to the way httplib sends POST requests. I have compared tcpdump listings from Python 2.4.3 and...
1
by: Robert Dodier | last post by:
Hello, I'm planning to write a program which automatically generates Python code. (1) Is there a limit on the length of a line in a Python program? (2) From what I understand, symbols,...
6
by: Russ P. | last post by:
I've always appreciated Python's lack of requirement for a semi-colon at the end of each line. I also appreciate its rules for automatic line continuation. If a statement ends with a "+", for...
3
by: MLH | last post by:
I don't understand why (a) works and compiles but (b) does not... (a) Set qdfTemp = .CreateQueryDef("", _ "SELECT * FROM Employees") (b) Set qdfTemp = .CreateQueryDef("", _ "SELECT...
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
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
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
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,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.