473,386 Members | 1,652 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.

Help with Dlookup and Mid

I have a field with a serial number in it. I want to use Mid to
extract the 4th and 5th characters, use them to lookup a value on a
small lookup table, and use the info from that table to fill in the
value for my lens field. I tried doing this:

=DLookUp([LensLookup]![LensName],[LensLookup],Mid([Camera Data]![Serial
Number],4,2)=[LensLookup]![LensID])

Where LensLookup is my lookup table, LensName is the value I want to
have appear

I will get the 4th and 5th characters from Serial Number and use them
to find the corrsponding numbers in the LensID on the LensLookup table.
I know that the two characters will be there. But I keep getting an
#Name? error. Is it a syntax problem or do I have my tables messed up?

Nov 13 '05 #1
4 2471
No, it means your control has the same name as the field it tries to
calculate. Change the name.

ba*****@gmail.com wrote:
I will get the 4th and 5th characters from Serial Number and use them
to find the corrsponding numbers in the LensID on the LensLookup table.
I know that the two characters will be there. But I keep getting an
#Name? error. Is it a syntax problem or do I have my tables messed up?


--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html

Nov 13 '05 #2

<ba*****@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
I have a field with a serial number in it. I want to use Mid to
extract the 4th and 5th characters, use them to lookup a value on a
small lookup table, and use the info from that table to fill in the
value for my lens field. I tried doing this:

=DLookUp([LensLookup]![LensName],[LensLookup],Mid([Camera Data]![Serial
Number],4,2)=[LensLookup]![LensID])

Where LensLookup is my lookup table, LensName is the value I want to
have appear

I will get the 4th and 5th characters from Serial Number and use them
to find the corrsponding numbers in the LensID on the LensLookup table.
I know that the two characters will be there. But I keep getting an
#Name? error. Is it a syntax problem or do I have my tables messed up?


Is "SerialNumber" a text or numeric field?

Nov 13 '05 #3
On 27 Jun 2005 12:32:29 -0700, ba*****@gmail.com wrote:
I have a field with a serial number in it. I want to use Mid to
extract the 4th and 5th characters, use them to lookup a value on a
small lookup table, and use the info from that table to fill in the
value for my lens field. I tried doing this:

=DLookUp([LensLookup]![LensName],[LensLookup],Mid([Camera Data]![Serial
Number],4,2)=[LensLookup]![LensID])

Where LensLookup is my lookup table, LensName is the value I want to
have appear

I will get the 4th and 5th characters from Serial Number and use them
to find the corrsponding numbers in the LensID on the LensLookup table.
I know that the two characters will be there. But I keep getting an
#Name? error. Is it a syntax problem or do I have my tables messed up?


1) Your syntax, for one thing, is incorrect.
Each argument in the DLookUp must be a string.

It is unclear to me if "Camera Data" is the name of the form this code
is on, or a table name. It should be the name of the form, and
[Serial] is a field on this form.
Try:

=DLookUp(["[LensName]","[LensLookup]","[LensID] = " & Mid([Serial
Number],4,2)

The above assumes the [LensID] field is a Number datatype.

Look up DLookUp in VBA Help.
Also look up
Where clause + Restrict data to a subset of records.

2) Also make sure that the name of this control is not the same as the
name of any field used in it's control source expression.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4
I got my problem fixed. Here is what I have now:

=DLookUp("[LensLookup]![LensName]","[LensLookup]","[LensLookup]![LensID]=
Mid ([Serial Number] , 4, 2) ")

It works great!

Now...new problem...new post

Nov 13 '05 #5

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

Similar topics

5
by: Kalvin Schroder | last post by:
I am fairly new to Access, and am trying to put together an invoice form. The main form in called InvoiceDetailFm. Source is the table InvoiceDetail and has invoice number, saleman, and CustID as...
0
by: Tony Williams | last post by:
I have posted a number of posts in the Access newsgroups concerning my problem with DLookup. I have had a number of the experts with helpful suggestions but I still can't get it to work! This is...
5
by: kevinjouco | last post by:
Hello Have searched the group for a solution to the following problem without success: Table 1 has Ref No (No Duplicates) & Min Max Value Fields ie Ref No 1 Min 1 Max 10 Ref No 2 Min 11 Max...
6
by: Don Sealer | last post by:
I've written this expression for a DLookup function. It works almost alright. What I'm trying to do is type in a description and the ID field (number) populates automatically. It works almost as...
6
by: deejayquai | last post by:
Hi I'm attempting to append multiple values into a new record, using multiple criteria from a listbox. I've got the basics for the code below but I get an "Error 3085 Undefined Function" for...
2
by: Don | last post by:
Can someone help me fix my DLookup problem. I'm far from proficiency with Access. I've been creating databases for several years for work with the help of many of you and trial and error. I have...
21
by: Thelma Lubkin | last post by:
I would like my DLookup criteria to say this: Trim(fieldX) = strVar: myVar = _ DLookup("someField", "someTable", "Trim(fieldX) = '" & strVar & '") I don't believe that this will work, and I...
2
by: Simon | last post by:
Hi, I need some help form someone. I use my database for my online shop, so once I have entered a order onto the database I have a button that creates the Email to the customer to let them know...
1
by: aharding | last post by:
Hello! I am using Access 2003 I have been playing with DLookup all morning and have not been successful yet. I have never used this function...and have some limited experience with code. I...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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.