Error msg

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?
 
F

fredg

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)
 
G

Guest

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)
 

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

Similar Threads


Top