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

Runtime error 2001

I am getting this error when running a module in Access 2002...anyone
know what it is? and how to correct it?
Nov 13 '05 #1
5 33054
Many causes. What line is giving the error?

Examples:
- 3rd argument for DLookup() is malformed.
- Filter string for a form is mal-formed.
- Something necessitated saving the record in the form, and the save failed,
so the thing you asked for can't happen either.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"kildareguy" <ke****@eircom.net> wrote in message
news:f6**************************@posting.google.c om...
I am getting this error when running a module in Access 2002...anyone
know what it is? and how to correct it?

Nov 13 '05 #2
Allen, Thanks, but am still having problems. The code is below:- Can you help?

Karl

Sub Logon()
'Variable declaration section
Dim Username
Dim Password
Dim Q1
Dim Q2
'Variable definition section
Username = InputBox( _
"You're using the error database" & _
Chr(13) & Chr(13) & _
"Please enter your username.")
Password = InputBox( _
"You're doing a great job!" & _
Chr(13) & Chr(13) & _
"Now, please enter your password")
'Query execution section
Qresult1 = DLookup("[Username]", "LogOn", "[Username] = username")
qresult2 = DLookup("[Password]", "Logon", "[Password] = password")
'Processing logic section
If Username = Q1 And Password = Q2 Then
MsgBox "Congratulations, Give this man a cigar!"
Else
MsgBox "Hey! That's not right!" & Chr(13) & "No cigar for you!"
End If
End Sub

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<41**********************@per-qv1-newsreader-01.iinet.net.au>...
Many causes. What line is giving the error?

Examples:
- 3rd argument for DLookup() is malformed.
- Filter string for a form is mal-formed.
- Something necessitated saving the record in the form, and the save failed,
so the thing you asked for can't happen either.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"kildareguy" <ke****@eircom.net> wrote in message
news:f6**************************@posting.google.c om...
I am getting this error when running a module in Access 2002...anyone
know what it is? and how to correct it?

Nov 13 '05 #3
The 3rd argument of DLookup() is not formed correctly.

Concatenate the value of the string variable into the string, surrounded by
quotes:
Qresult1 = DLookup("[Username]", "LogOn", "[Username] = """ & username &
"""")

For more help on how to build the arguments for DLookup(), see:
http://members.iinet.net.au/~allenbrowne/casu-07.html
BTW, instead of using 2 input boxes, you might like to create a little
unbound form with 2 text boxes, and a command button to make it go. If you
set the Input Mask of the 2nd text box to:
Password
I think you will like the way it looks when the user enters their password.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"karl" <km******@eircom.net> wrote in message
news:90**************************@posting.google.c om...
Allen, Thanks, but am still having problems. The code is below:- Can you
help?

Karl

Sub Logon()
'Variable declaration section
Dim Username
Dim Password
Dim Q1
Dim Q2
'Variable definition section
Username = InputBox( _
"You're using the error database" & _
Chr(13) & Chr(13) & _
"Please enter your username.")
Password = InputBox( _
"You're doing a great job!" & _
Chr(13) & Chr(13) & _
"Now, please enter your password")
'Query execution section
Qresult1 = DLookup("[Username]", "LogOn", "[Username] = username")
qresult2 = DLookup("[Password]", "Logon", "[Password] = password")
'Processing logic section
If Username = Q1 And Password = Q2 Then
MsgBox "Congratulations, Give this man a cigar!"
Else
MsgBox "Hey! That's not right!" & Chr(13) & "No cigar for you!"
End If
End Sub

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:<41**********************@per-qv1-newsreader-01.iinet.net.au>...
Many causes. What line is giving the error?

Examples:
- 3rd argument for DLookup() is malformed.
- Filter string for a form is mal-formed.
- Something necessitated saving the record in the form, and the save
failed,
so the thing you asked for can't happen either.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"kildareguy" <ke****@eircom.net> wrote in message
news:f6**************************@posting.google.c om...
>I am getting this error when running a module in Access 2002...anyone
> know what it is? and how to correct it?

Nov 13 '05 #4
km******@eircom.net (karl) wrote in message news:<90**************************@posting.google. com>...
I am getting the error on the 1st LOOKUP line...Q1 =
DLookup("[Username]", "LogOn", "[Username] = username")

Any suggestions?

Karl



Sub Logon()
'Variable declaration section
Dim Username
Dim Password
Dim Q1
Dim Q2
'Variable definition section
Username = InputBox( _
"You're using the error database" & _
Chr(13) & Chr(13) & _
"Please enter your username.")
Password = InputBox( _
"You're doing a great job!" & _
Chr(13) & Chr(13) & _
"Now, please enter your password")
'Query execution section
Q1 = DLookup("[Username]", "LogOn", "[Username] = username")
Q2 = DLookup("[Password]", "Logon", "[Password] = password")
'Processing logic section
If Username = Q1 And Password = Q2 Then
MsgBox "Congratulations, Give this man a cigar!"
Else
MsgBox "Hey! That's not right!" & Chr(13) & "No cigar for you!"
End If
End Sub

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<41**********************@per-qv1-newsreader-01.iinet.net.au>...
Many causes. What line is giving the error?

Examples:
- 3rd argument for DLookup() is malformed.
- Filter string for a form is mal-formed.
- Something necessitated saving the record in the form, and the save failed,
so the thing you asked for can't happen either.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"kildareguy" <ke****@eircom.net> wrote in message
news:f6**************************@posting.google.c om...
I am getting this error when running a module in Access 2002...anyone
know what it is? and how to correct it?

Nov 13 '05 #5
Two problems. The first is that your variable username must be outside of
the quotes in order for the DLookup to get the value that's in the variable.
The second is that values for text fields must be enclosed in quotes.

Q1 = DLookup("[Username]", "LogOn", "[Username] = " & Chr$(34) & username &
Chr$(34))
Q2 = DLookup("[Password]", "Logon", "[Password] = " & Chr$(34) & password
& Chr$(34))

(Chr$(34) is ")

There might be a possible 3rd problem: username and password may be reserved
words, so if you're still having problems, you might want to rename them.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"karl" <km******@eircom.net> wrote in message
news:90**************************@posting.google.c om...
km******@eircom.net (karl) wrote in message news:<90**************************@posting.google. com>... I am getting the error on the 1st LOOKUP line...Q1 =
DLookup("[Username]", "LogOn", "[Username] = username")

Any suggestions?

Karl



Sub Logon()
'Variable declaration section
Dim Username
Dim Password
Dim Q1
Dim Q2
'Variable definition section
Username = InputBox( _
"You're using the error database" & _
Chr(13) & Chr(13) & _
"Please enter your username.")
Password = InputBox( _
"You're doing a great job!" & _
Chr(13) & Chr(13) & _
"Now, please enter your password")
'Query execution section
Q1 = DLookup("[Username]", "LogOn", "[Username] = username")
Q2 = DLookup("[Password]", "Logon", "[Password] = password")
'Processing logic section
If Username = Q1 And Password = Q2 Then
MsgBox "Congratulations, Give this man a cigar!"
Else
MsgBox "Hey! That's not right!" & Chr(13) & "No cigar for you!"
End If
End Sub

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:<41**********************@per-qv1-newsreader-01.iinet.net.au>...
Many causes. What line is giving the error?

Examples:
- 3rd argument for DLookup() is malformed.
- Filter string for a form is mal-formed.
- Something necessitated saving the record in the form, and the save failed, so the thing you asked for can't happen either.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"kildareguy" <ke****@eircom.net> wrote in message
news:f6**************************@posting.google.c om...
>I am getting this error when running a module in Access 2002...anyone
> know what it is? and how to correct it?

Nov 13 '05 #6

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

Similar topics

11
by: frr | last post by:
Hi, After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error: >>> import themes Traceback (most recent call last): File "<interactive input>", line 1, in ? File "themes.py", line...
2
by: Artur | last post by:
Hi Newsgroup, im currently working on programming a asp.net application consuming an Webservice hosted on Apache/Axis. I have generated WSDL and Proxy classes from VisualStudio.net. But when...
0
by: Adam Smith | last post by:
Hello. I've got a total of 5 schemas. They are: 1 - 1.xsd - a description of a city 2 - 2.xsd - a description of a town 3 - CityHall.xsd - a description of a cityhall-meant to be part of a...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
0
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. ...
2
by: Y2K | last post by:
First.. I sincerely appreciate any assistance in resolving this. I've searched the entire PC for assembly.adaptive.xsd, and it's non existent. Here's the problem: I've published a standard...
1
by: noneedforthis | last post by:
I'm a new user of Access/VB and ran in to this nasty wall. (Access 2003, VB6.3, Windows XP) Runtime Error 2001: You cancelled the previous operation. The highlighted line is the one where the...
7
by: David01 | last post by:
When I run some code behind a button i get a runtime error message. The strange thing is that the code run perfectly some months ago. Can some one help me ! Some additional information: The company...
3
by: AccessBeetle | last post by:
I am creating simple login form with linked tables(atual tables are in SQL 2005) in access 2003. Here is my code. Option Compare Database Private Sub cmdSignIn_Click() 'Check to see if data...
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:
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.