473,651 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2495
No, it means your control has the same name as the field it tries to
calculate. Change the name.

ba*****@gmail.c om 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******** *************@g 44g2000cwa.goog legroups.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 "SerialNumb er" a text or numeric field?

Nov 13 '05 #3
On 27 Jun 2005 12:32:29 -0700, ba*****@gmail.c om 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
3195
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 some of its fields. I have put together a combobox, named it CustID, and am trying to use DLookup() to bring the complete Customer Name etc onto the form using DLookup() function for the fields I need. The combobox will bring up the CustID in...
0
1629
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 what I am trying to do: I have a table called tblmaintabs which holds year to date data for a number of companies which they supply on a quarterly basis. The field txtDomfacsoleqtr is one of the fields that holds part of this data. The...
5
2324
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 20 etc Table 2 is linked by Ref No (Allows Duplicates) & Recorded Value
6
508
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 I've said. It doesn't populate until I go to a new record. Then if I go back to the record the number is in the field. Instead of populating immediately it waits until I've created a new record. Am I making sense with this description. Here's...
6
5786
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 the Dlookup part of it. Dim db As Database Dim rec As DAO.Recordset
2
2271
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 used DLookup several times and I've actually re-created the same lookup just in different forms. Here's my problem. I'm using dlookup when I enter a part description it adds the part number for me. I choose the part description from a combo...
21
3345
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 won't be at a machine with access to Access for a while, so can someone please tell me how to write this? thanks, --thelma
2
1534
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 the order has been placed. I use to use as a auto number but I have just changed it to Which is not a auto number as I type them in. But now my VB code for the email button does not work.
1
1799
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 will post what I have tried so far and hopefully someone can help me problem solve. I have tried three different methods... (I know Calculation is spelled wrong..I have to go through my database and fix it everywhere just haven't had the time...
0
8275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8795
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.