Error msg

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an unbound form designed to take a part #, break it down, and tell the
user the specifications of the part. strConfigCode contains a single
character that is a key value in a lookup table. I'm tyring to get a
description (in the field ConfigurationCode) from this lookup table.

I keep getting the following error:
Run-time error '2001':
You canceled the previous operation.

Here's my code:
strConfig = DLookup("Configuration", "tblGSeriesConfigurationCodes", _
"[ConfigurationCode] = strConfigCode")

I've tried useing brackets and not using brackets and can't seem to quite
get it.
Any suggestions?
 
I have an unbound form designed to take a part #, break it down, and tell the
user the specifications of the part. strConfigCode contains a single
character that is a key value in a lookup table. I'm tyring to get a
description (in the field ConfigurationCode) from this lookup table.

I keep getting the following error:
Run-time error '2001':
You canceled the previous operation.

Here's my code:
strConfig = DLookup("Configuration", "tblGSeriesConfigurationCodes", _
"[ConfigurationCode] = strConfigCode")

I've tried useing brackets and not using brackets and can't seem to quite
get it.
Any suggestions?

Try:

What is the datatype of [ConfigurationCode]?

If is a Text datatype, then:

Dim strConfigCode as String
strConfigCode = "SomeTextValue"
strConfig = DLookup("Configuration", "tblGSeriesConfigurationCodes", _
"[ConfigurationCode] = '" & strConfigCode & "'")

However, if [ConfigurationCode] is a Number datatype, then try:

Dim intConfigCode as Integer (or Double or Long, whatever the field
size is)
intConfigCode = 12345
strConfig = DLookup("Configuration", "tblGSeriesConfigurationCodes", _
"[ConfigurationCode] = " & intConfigCode)
 
Thank you. That fixed it
_______________
fredg said:
I have an unbound form designed to take a part #, break it down, and tell the
user the specifications of the part. strConfigCode contains a single
character that is a key value in a lookup table. I'm tyring to get a
description (in the field ConfigurationCode) from this lookup table.

I keep getting the following error:
Run-time error '2001':
You canceled the previous operation.

Here's my code:
strConfig = DLookup("Configuration", "tblGSeriesConfigurationCodes", _
"[ConfigurationCode] = strConfigCode")

I've tried useing brackets and not using brackets and can't seem to quite
get it.
Any suggestions?

Try:

What is the datatype of [ConfigurationCode]?

If is a Text datatype, then:

Dim strConfigCode as String
strConfigCode = "SomeTextValue"
strConfig = DLookup("Configuration", "tblGSeriesConfigurationCodes", _
"[ConfigurationCode] = '" & strConfigCode & "'")

However, if [ConfigurationCode] is a Number datatype, then try:

Dim intConfigCode as Integer (or Double or Long, whatever the field
size is)
intConfigCode = 12345
strConfig = DLookup("Configuration", "tblGSeriesConfigurationCodes", _
"[ConfigurationCode] = " & intConfigCode)
 
Back
Top