Error Message "You cancelled previous operation"

G

Guest

What causes this error message. I am getting this message on a DLookup
expression
 
F

fredg

What causes this error message. I am getting this message on a DLookup
expression

With the lack of further information I doubt if any one can tell with
certainty.
What is the DLookUp code? Where is it placed? What else is going on?
Have you canceled anything at all at the time this was run?
How do you know it's this DLookUp and not something else?
 
G

Guest

Below is the DLookup() code. It is being placed in a procedure event Click()
on a Comand Button:

I am using this to validation the [UserId]:

Dim Result As String
Dim strUserID As String
strUserID = Me.LookupUserID

Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Forms!frmLogin!LookupUserID)

MsgBox Result

I will welcome another way to validate the [UserId] input.
 
F

fredg

Below is the DLookup() code. It is being placed in a procedure event Click()
on a Comand Button:

I am using this to validation the [UserId]:

Dim Result As String
Dim strUserID As String
strUserID = Me.LookupUserID

Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Forms!frmLogin!LookupUserID)

MsgBox Result

I will welcome another way to validate the [UserId] input.

fredg said:
With the lack of further information I doubt if any one can tell with
certainty.
What is the DLookUp code? Where is it placed? What else is going on?
Have you canceled anything at all at the time this was run?
How do you know it's this DLookUp and not something else?

Dim Result As String
Dim strUserID As String
strUserID = Me.LookupUserID

Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Forms!frmLogin!LookupUserID)

I'm confused.
What is the purpose of strUserID?
You give it the value of LookupUserID, but then don't use it anywhere.
What is the datatype of UserID? Is it a Number? If so why are you
giving the String strUserID the value of a Number field?

If UserID is a Text datatype field than you need to surround the value
with single quotes.
If all of this code is being done on the form named "frmLogin" then
you can substitute the Me! keyword for the forms!frmLogin syntax.

Try...
If UserID is a number datatype:
Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Me![LookupUserID])

If UserID is a Text datatype:
Result = DLookup("[UserId]", "tblOperators", "[UserId] ='" &
Me![LookupUserID] & "'")

Just for clarity, the quotes are like this:
"[UserId] =' " & Me![LookupUserID] & " ' ")

The problem with showing a MsgBox after each DLookUp here is that the
message will slow down entry each time whether the ID exists or not.

You can alsojust count, and if the count is greater than 0 the UserID
is in the file and no message need be sent. If the count is 0 then
the UserID is Not in the table, and now you can sent the message:

Dim Result as Integer
Result = DCount("*", "tblOperators", "[UserId] ='" &
Me![LookupUserID] & "'")
If Result = 0 then
MsgBox "Not on file"
End If
 
G

Guest

Thank you that syntax solve my problem.
But now I am getting an error with this addition to the syntax
Result = DCount("*", "qryOperators", "[UserId] ='" & [LookupUserID] & "'" _
And "[Password] ='" & [PassWordLookUp] & "'")

I need to verified the password also. The error message is "Mismatch data
type"
both the userId and Password fields are text data.

Also, I need to move to that record and display other fields in the record.
once the lookup is done.

Thank you for your assistance.

fredg said:
Below is the DLookup() code. It is being placed in a procedure event Click()
on a Comand Button:

I am using this to validation the [UserId]:

Dim Result As String
Dim strUserID As String
strUserID = Me.LookupUserID

Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Forms!frmLogin!LookupUserID)

MsgBox Result

I will welcome another way to validate the [UserId] input.

fredg said:
On Tue, 8 Feb 2005 13:25:08 -0800, iholder wrote:

What causes this error message. I am getting this message on a DLookup
expression

With the lack of further information I doubt if any one can tell with
certainty.
What is the DLookUp code? Where is it placed? What else is going on?
Have you canceled anything at all at the time this was run?
How do you know it's this DLookUp and not something else?

Dim Result As String
Dim strUserID As String
strUserID = Me.LookupUserID

Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Forms!frmLogin!LookupUserID)

I'm confused.
What is the purpose of strUserID?
You give it the value of LookupUserID, but then don't use it anywhere.
What is the datatype of UserID? Is it a Number? If so why are you
giving the String strUserID the value of a Number field?

If UserID is a Text datatype field than you need to surround the value
with single quotes.
If all of this code is being done on the form named "frmLogin" then
you can substitute the Me! keyword for the forms!frmLogin syntax.

Try...
If UserID is a number datatype:
Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Me![LookupUserID])

If UserID is a Text datatype:
Result = DLookup("[UserId]", "tblOperators", "[UserId] ='" &
Me![LookupUserID] & "'")

Just for clarity, the quotes are like this:
"[UserId] =' " & Me![LookupUserID] & " ' ")

The problem with showing a MsgBox after each DLookUp here is that the
message will slow down entry each time whether the ID exists or not.

You can alsojust count, and if the count is greater than 0 the UserID
is in the file and no message need be sent. If the count is 0 then
the UserID is Not in the table, and now you can sent the message:

Dim Result as Integer
Result = DCount("*", "tblOperators", "[UserId] ='" &
Me![LookupUserID] & "'")
If Result = 0 then
MsgBox "Not on file"
End If
 
F

fredg

Thank you that syntax solve my problem.
But now I am getting an error with this addition to the syntax
Result = DCount("*", "qryOperators", "[UserId] ='" & [LookupUserID] & "'" _
And "[Password] ='" & [PassWordLookUp] & "'")

I need to verified the password also. The error message is "Mismatch data
type"
both the userId and Password fields are text data.

Also, I need to move to that record and display other fields in the record.
once the lookup is done.

Thank you for your assistance.

fredg said:
Below is the DLookup() code. It is being placed in a procedure event Click()
on a Comand Button:

I am using this to validation the [UserId]:

Dim Result As String
Dim strUserID As String
strUserID = Me.LookupUserID

Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Forms!frmLogin!LookupUserID)

MsgBox Result

I will welcome another way to validate the [UserId] input.

:

On Tue, 8 Feb 2005 13:25:08 -0800, iholder wrote:

What causes this error message. I am getting this message on a DLookup
expression

With the lack of further information I doubt if any one can tell with
certainty.
What is the DLookUp code? Where is it placed? What else is going on?
Have you canceled anything at all at the time this was run?
How do you know it's this DLookUp and not something else?

Dim Result As String
Dim strUserID As String
strUserID = Me.LookupUserID

Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Forms!frmLogin!LookupUserID)

I'm confused.
What is the purpose of strUserID?
You give it the value of LookupUserID, but then don't use it anywhere.
What is the datatype of UserID? Is it a Number? If so why are you
giving the String strUserID the value of a Number field?

If UserID is a Text datatype field than you need to surround the value
with single quotes.
If all of this code is being done on the form named "frmLogin" then
you can substitute the Me! keyword for the forms!frmLogin syntax.

Try...
If UserID is a number datatype:
Result = DLookup("[UserId]", "tblOperators", "[UserId] =" &
Me![LookupUserID])

If UserID is a Text datatype:
Result = DLookup("[UserId]", "tblOperators", "[UserId] ='" &
Me![LookupUserID] & "'")

Just for clarity, the quotes are like this:
"[UserId] =' " & Me![LookupUserID] & " ' ")

The problem with showing a MsgBox after each DLookUp here is that the
message will slow down entry each time whether the ID exists or not.

You can alsojust count, and if the count is greater than 0 the UserID
is in the file and no message need be sent. If the count is 0 then
the UserID is Not in the table, and now you can sent the message:

Dim Result as Integer
Result = DCount("*", "tblOperators", "[UserId] ='" &
Me![LookupUserID] & "'")
If Result = 0 then
MsgBox "Not on file"
End If

Your difficulty is that the AND portion of the clause is not included
within the quotes.
If added a space between them just for clarity. Try:

"[UserId] =' " & [LookupUserID] & " ' And [Password] = ' " &
[PassWordLookUp] & " ' ")

Both [UserID] and [Password] are assumed to be Text datatypes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top