473,320 Members | 2,112 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,320 software developers and data experts.

Report back the value from a field in a table when I know another field in the table

MattFitzgerald
I have a main menu ("Frm_Startup") which contains a drop down box for selecting a field "LE ID" from my customer table where the "LE ID" is the primary key and there is another field with the customers "Legal Entity Desc"

I have a button "Add new Order" which opens a new form where I can enter new orders.

In the form for new orders the Default value for the LE ID is the value selected in the main menu .

I wanted to pick up the customers "Legal Entity Name" from my Customer Table to populate the default value for the Customer Name field in my orders table using the LE ID enterd on the main menu.

In the properties of "Customer Name" for default value I tried the code below

Expand|Select|Wrap|Line Numbers
  1. = [Tbl_LE_List]![LEGAL ENTITY DESC] where [Tbl_LE_List]![LE ID] = Forms![Frm_Startup]![CMD LE] 
Please can some one help I am new to Access and think I have got a bit lost,
Aug 13 '07 #1
3 1237
Rabbit
12,516 Expert Mod 8TB
I have a main menu ("Frm_Startup") which contains a drop down box for selecting a field "LE ID" from my customer table where the "LE ID" is the primary key and there is another field with the customers "Legal Entity Desc"

I have a button "Add new Order" which opens a new form where I can enter new orders.

In the form for new orders the Default value for the LE ID is the value selected in the main menu .

I wanted to pick up the customers "Legal Entity Name" from my Customer Table to populate the default value for the Customer Name field in my orders table using the LE ID enterd on the main menu.

In the properties of "Customer Name" for default value I tried the code below

Expand|Select|Wrap|Line Numbers
  1. = [Tbl_LE_List]![LEGAL ENTITY DESC] where [Tbl_LE_List]![LE ID] = Forms![Frm_Startup]![CMD LE] 
Please can some one help I am new to Access and think I have got a bit lost,
You can't refer to items in a table that way.

You can, however, use the DLookup function.
Expand|Select|Wrap|Line Numbers
  1. DLookup("[LEGAL ENTITY DESC]", "[Tbl_LE_List]", "[LE ID] = Forms![Frm_Startup]![CMD LE]"
  2.  
It's not the most efficient solution but the other one is more complicated.
Aug 13 '07 #2
Thanks that answers my question - and worked just as I wanted it to.

With the more efficient method I would be very interested to know it if it only takes a short amount of your time.
Aug 16 '07 #3
Rabbit
12,516 Expert Mod 8TB
Actually, I just realized it doesn't work unless [LEGAL ENTITY DESC] is also stored in your main menu.
Aug 16 '07 #4

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

Similar topics

6
by: John | last post by:
Hi, I have simple database based on 3 tables. Relationship is 'one to many' between table 1 and 2, also between 2 and 3 table'one to many'. I have made form where I enter data in all 3 tables....
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
9
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want...
11
by: James P. | last post by:
Hello, I have a report with the Priority field is used as sort order and grouping. The problem is the data in this Priority field if sorted in ascending order is: High, Low, and Medium. How...
5
by: Greg Teets | last post by:
I am running an Access report from VB via ADO. The report has a field that shows the date it was run. How can I return the data from this field to VB or have Access post it to a table when the...
9
by: MLH | last post by:
Trouble is, it doesn't happen every time. Yesterday, for example, it happened only once and not again afterward. Some days ago, a similar situation. Today, well - I tried 7 times straight to open...
3
by: melnhed | last post by:
---Report the current filtered records from a Form--- Hello All, I've seen this topic discussed before, but the solution described then doesn't work in my particular case. My Config: ...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
6
by: Gord | last post by:
I have a report whose Record Source I set in code when clicking on a command button on a form. This Record Source is a table that gets created by the code. I have a textbox on the report whose...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.