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

Dlookup String Problem

5
I am trying to use a simple style for DlookUp Function as a value for a calculated column HostAmount in a select query on other table as following:
Expand|Select|Wrap|Line Numbers
  1. HostAmount: DLookUp("Amount","tblCardHost","AuthorisationCode =' 182800'")
But access is responding an error message indicates while running this select query.

that Access can not find the name of 'AuthorisationCode' you entered in the expression.

Please help ASAP,

Thanks
Shereef Wahba
Aug 21 '17 #1

✓ answered by NeoPa

Using DLookUp() is certainly not to be advised within SQL if it's possible to avoid - and it's hard to think of a situation where it's not.

On the other hand, the message is telling you that your table [tblCardHost] has no field with the exact name [AuthorisationCode]. It may be worth you checking the spelling of the field in the table.

3 2238
NeoPa
32,556 Expert Mod 16PB
Using DLookUp() is certainly not to be advised within SQL if it's possible to avoid - and it's hard to think of a situation where it's not.

On the other hand, the message is telling you that your table [tblCardHost] has no field with the exact name [AuthorisationCode]. It may be worth you checking the spelling of the field in the table.
Aug 22 '17 #2
PhilOfWalton
1,430 Expert 1GB
@Neopa

I agree completely with your views on DLookup, but I have used it, albeit reluctantly, when the joins make a query not updateable.

@swahaba
Firstly Neopa's advice is very sound, but if you do have to use DLookup then what is 18280?

The normal DLookup syntax is
Expand|Select|Wrap|Line Numbers
  1. HostAmount: DLookUp("Amount","tblCardHost","AuthorisationCode = " & MyField)
  2.  
Where MyField is numeric or

Expand|Select|Wrap|Line Numbers
  1. HostAmount: DLookUp("Amount","tblCardHost","AuthorisationCode = " & Chr$(34) & MyField & Chr$(34))
  2.  
Where MyField is Text

There are alternatives to using Chr$(34), but the look messy (depending on the font.
Expand|Select|Wrap|Line Numbers
  1. HostAmount: DLookUp("Amount","tblCardHost","AuthorisationCode = '" & MyField & "'")
  2.  
Phil
Aug 22 '17 #3
NeoPa
32,556 Expert Mod 16PB
You're quite right Phil. It was difficult to bring anything to mind yesterday but that's certainly one instance where it could be used. Even in that case though, a sub-query would probably be a better solution. Certainly I wouldn't want to give it out as an absolute, but the understanding that it should be avoided where possible I think is perfectly on script.
Aug 22 '17 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Filip Dreger | last post by:
Each function has a func_code property that is suposed to contain the pure bytecode of the function. All the context (including reference to relevant namespaces) is stored in different fields of...
7
by: john | last post by:
On my form i have a message box called txtItemDesc that displays the french phrase qualité Père Noël. Now then when i run this code on that text box: Dim chrArr() As Char chrArr =...
2
by: anelma via .NET 247 | last post by:
Following code works fine, when compiled with VS 6.0, but not anymore when compiled in .NET. What's wrong here, I can't see it by myself? arrString content will be garbage with .net compilation, but...
2
by: chris.thompson13 | last post by:
I am having a problem setting the criteria part of the DLookup method correctly and am consequently getting an error message. I have a database of staff duties, part of which is a query (qryDaily)...
2
by: Diana | last post by:
I thought I had this process pretty well down pat, but I'm getting a syntax error on the following code: *****Code***** 'Check for users - can't get this to work... Dim strUser As String ...
8
by: kujahleague | last post by:
Dear all I'm new here and also new to C language. I have been stuck with string problem in C for some time and I decide to post here to get some help, please kindly explain what I get wrong with the...
2
by: Fred | last post by:
Hello, I am having a problem with a multiline string that I create from a byte array (xml file). I am using StringBuilder and Ecoding the string to ASCII (code below). / Upload the...
4
by: skbrede | last post by:
Has anyone else had trouble with Access Dlookup function ? It works fine with a numeric matche criteria, but will not work with a "text" compare!! Would appreciate any help anyone has. If not is...
4
by: Soulspike | last post by:
Hello all. Currently I am still useing access97 (sad I know) and I can not seem to get this dlookup function in my vb code to work. I keep getting a type mismatch error when I run the code. I...
5
by: neelsfer | last post by:
Did anybody else also experienced hassles. MY DLookup()code i use to prevent duplicate entries in 2 different applications stopped working. Quite frustrating to say the least. 2007 Microsoft Office...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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,...

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.