473,654 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dlookup Field Not Saving

8 New Member
I have an Acess database with a lookup field, the lookup is working correctly on the form, it accesses another table called raw materials for the information.

=DLookUp("[£ Per Kg]","[Raw Materials]","[ID]=[material (main)]")

The Dlookup field is not saving to the Input table which is linked to the form.

What am I doing wrong?
Oct 4 '07 #1
15 4528
MikeTheBike
639 Recognized Expert Contributor
I have an Acess database with a lookup field, the lookup is working correctly on the form, it accesses another table called raw materials for the information.

=DLookUp("[£ Per Kg]","[Raw Materials]","[ID]=[material (main)]")

The Dlookup field is not saving to the Input table which is linked to the form.

What am I doing wrong?
Hi

Moore information required.

Where/how are you using =DLookUp("[£ Per Kg]","[Raw Materials]","[ID]=[material (main)]")

Is the form bound, if so, to what table.
Where/how are you trying to save the lookup value
etc.

MTB
Oct 5 '07 #2
paullofthouse
8 New Member
I am putting the dlookup command in the control source of field Main Mat £ Per Kg on a form called data input form.

I think the form is bound to the input table, but the Dlookup field is trying to pull the price from the Raw Materials table.

It compares the Material Main field value in the data input form to the £ Per Kg field on the Raw Materials table.

The Dlookup works fine on the input form, but when it is saved the value that the Dlookup query has found is not saving to the Input Table, the field is just blank. Does it have to be connected in some way?.
Oct 8 '07 #3
MikeTheBike
639 Recognized Expert Contributor
I am putting the dlookup command in the control source of field Main Mat £ Per Kg on a form called data input form.

I think the form is bound to the input table, but the Dlookup field is trying to pull the price from the Raw Materials table.

It compares the Material Main field value in the data input form to the £ Per Kg field on the Raw Materials table.

The Dlookup works fine on the input form, but when it is saved the value that the Dlookup query has found is not saving to the Input Table, the field is just blank. Does it have to be connected in some way?.
Hi again

If you are entering a new record, then try putting this
=DLookUp("[£ Per Kg]","[Raw Materials]","[ID]=[material (main)]")
in the DEFAULT value of the [Main Mat £ Per Kg] control (not the Control Source), and set the Control Source as the field you want to save it in, ie. bind it to [Main Mat £ Per Kg]. Assuming the form is bound to this table!

See if that does it.


MTB
Oct 8 '07 #4
paullofthouse
8 New Member
Hi,

Tried that it just puts £0.000 in the Main Mat £ Per Kg field, am I doing something wrong?

Paul
Oct 8 '07 #5
MikeTheBike
639 Recognized Expert Contributor
Hi,

Tried that it just puts £0.000 in the Main Mat £ Per Kg field, am I doing something wrong?

Paul
Hi

We seem to be missing something

Are you trying to save a NEW record?

If so, then what value is displayed in the control before it is saved; is it the one you expect?

Where is the value of [material (main)] (in "[ID]=[material (main)]") coming from ?

MTB
Oct 9 '07 #6
paullofthouse
8 New Member
Hi, Thanks for help so far.

Yes I am trying to save a new record

The value in Main Mat £ Per Kg now is £0.000, this is in the form before it is saved and this amount gets saved onto the table.

Have put the default value as my Dlookup information and the control source has the Main Mat £ Per Kg, Dlookup does not seem to work unless it is in control source field, then it does not save.

Material (Main) is a combo box in the same input form, (main mat £ per kg was also a combo box before I started with Dlookup).

ID is an id code, this is in the Raw materials table.

What I am trying to acheive is for the Main Mat £ Per Kg field to auto complete with the price from the Raw Materials table. It needs to lookup the value of material main in the ID column and then extract the price.
Oct 9 '07 #7
MikeTheBike
639 Recognized Expert Contributor
Hi, Thanks for help so far.

Yes I am trying to save a new record

The value in Main Mat £ Per Kg now is £0.000, this is in the form before it is saved and this amount gets saved onto the table.

Have put the default value as my Dlookup information and the control source has the Main Mat £ Per Kg, Dlookup does not seem to work unless it is in control source field, then it does not save.

Material (Main) is a combo box in the same input form, (main mat £ per kg was also a combo box before I started with Dlookup).

ID is an id code, this is in the Raw materials table.

What I am trying to acheive is for the Main Mat £ Per Kg field to auto complete with the price from the Raw Materials table. It needs to lookup the value of material main in the ID column and then extract the price.
Hi

I think the Defult Value should be

=DLookUp("[£ Per Kg]","[Raw Materials]","[ID]=” & [material (main)])
not
=DLookUp("[£ Per Kg]","[Raw Materials]","[ID]= [material (main)]")

This will look at the VALUE of the Form Control named [material (main)] ie. the ComboBox(?), and not the string "[material (main)]"


??
MTB
Oct 9 '07 #8
paullofthouse
8 New Member
Hi, tried what you said.

Unfortunately it came up with name? error message in the main Mat £ per kg field and then went to £0.000 when something was entered in the material (main) field. material main is text box and id is a number field.
Oct 9 '07 #9
MikeTheBike
639 Recognized Expert Contributor
Hi, tried what you said.

Unfortunately it came up with name? error message in the main Mat £ per kg field and then went to £0.000 when something was entered in the material (main) field. material main is text box and id is a number field.
Hi

The Name? error means that the [material (main)] control/field name was not recognised.

However, even when this method method is sorted, I don't think it will not do what you want because it will only work with the default value of the of the [material (main)] ComboBox, and changing the value will not change the value in the [Main Mat £ Per Kg] control.

So what I suggest is puting this code in the [Main Mat £ Per Kg] control After Upade event

If Me.NewRecord Then [Main Mat £ Per Kg] = DLookUp("[£ Per Kg]","[Raw Materials]","[ID]=” & [material (main)])

MTB
Oct 10 '07 #10

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

Similar topics

1
20775
by: KLAU | last post by:
I have a field that retrieves information from an expression in a query. I have used a DLookup function to get the calculated field from the query. However, the relationship is 1-to-many so one site could have many units. How do I have the DLookUp field value change to a newly calcuated field when I navigate through the units? please see example below: On the Form: A site can have many units.
6
2330
by: JLM | last post by:
What am I missing here? I have a form where I enter a "Class Code". This value corresponds to what sits in table "class code descriptions" along with the "title" of each "class code." Key field is "class code." I want a text box to be populated with the "title" which corresponds to the "class code" which I enter in the form. The control source for the text box is:
1
5240
by: mstery | last post by:
I have a report generated via an ID selection made in a dropdown on a form. The report filters by an on click event in a preview report button on the form. Everything in the report, including subreports, filters perfectly, with the exception of a running sum DLookup field on the main report. This field looks up a value in a foreign table. I'm not clear where I'm supposed to be filtering this field, since it obviously isn't picking up the...
4
2496
by: basstwo | last post by:
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(!,,Mid(!,4,2)=!) Where LensLookup is my lookup table, LensName is the value I want to have appear
8
4316
by: Christine Henderson | last post by:
I have a problem using the above function in the following simplified circumstance: In the lookup table called "Klms Travelled" I have 3 fields, eg: Receiver Name Receiver Suburb Klms Distance Jones Melbourne 500 Harrison Sydney 200 Ford Brisbane 700 Jones ...
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...
1
2414
by: MLH | last post by:
I have a query that looks up records in tblReturnReceipts and other related tables. One of the other tables is tblCorrespondence. The resulting dynaset consists of five records. Each has a unique field value and each has a unique field value. I would like to add an additional field to the query that performs a DLookup for some other stuff - using the query's value in the DLookup's criteria section. Of course, I'm having difficulty...
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
1
1627
by: Deac | last post by:
I was asked to help a friend with a database and am in over my head! The customer table has been in place and they have used a paper copy of the pricing table to make manual changes and computations in the past (a lot, lot, lot of work!) I'm pretty new at this and am looking for some help! There are two tables in a database (of over 8,000 records) - one is "t_Customers" the other is "t_PricingByZone" (data in this table changes often).
0
8379
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
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
8816
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...
1
8494
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,...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
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
1597
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.