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

How to select a record from a different table based on info entered

I have 2 tables - tblCertData and tblHL
tblCertData includes multiple fields, but the ones that matter at this point are
[1HL] (number field) and [Matl] (text field).

tblHL includes fields [HL] (number field) and [MatlDesc] (text field)

On my form that writes all of its data to tblCertData there is a dropdown box for [1HL]. The info in this dropdown box comes from tblHL [HL].

I would like to have an event run on the afterupdate of [1HL] that would update the fieid [Matl] from the record (from tblHL) that the [HL] was chosen from.

Maybe that got confusing after you read it, I am sorry, I am trying to give as much info as possible.

I am certain that this should require a Select statement, but please dont try to make me guess where to put it.

The statement

[Matl] = SELECT [MatlDesc] FROM [tblHL] WHERE me.[1HL] = [HL]

probably gives you more information from what i would like to do than my confusing ramble earlier. But as I am sure that you have already noticed from the above example..........I dont know anything about SELECT statements, lol.

If i had the statement correct.....i dont even know where to put it. Please Help. As always your help is much appreciated.
Nov 2 '08 #1
1 1287
PianoMan64
374 Expert 256MB
I have 2 tables - tblCertData and tblHL
tblCertData includes multiple fields, but the ones that matter at this point are
[1HL] (number field) and [Matl] (text field).

tblHL includes fields [HL] (number field) and [MatlDesc] (text field)

On my form that writes all of its data to tblCertData there is a dropdown box for [1HL]. The info in this dropdown box comes from tblHL [HL].

I would like to have an event run on the afterupdate of [1HL] that would update the fieid [Matl] from the record (from tblHL) that the [HL] was chosen from.

Maybe that got confusing after you read it, I am sorry, I am trying to give as much info as possible.

I am certain that this should require a Select statement, but please dont try to make me guess where to put it.

The statement

[Matl] = SELECT [MatlDesc] FROM [tblHL] WHERE me.[1HL] = [HL]

probably gives you more information from what i would like to do than my confusing ramble earlier. But as I am sure that you have already noticed from the above example..........I dont know anything about SELECT statements, lol.

If i had the statement correct.....i dont even know where to put it. Please Help. As always your help is much appreciated.
Hey crazyhouse:

If I understand what you've said, here is what you need to do:

1. Right-click on your dropdown box that you want this list of options to appear.
2. make sure you click on the ALL tab at the top of the properties window.
3. In the Control Source field, type the name of the field that will store the value for tblCertData (I think it is 1HL) that is coming from the tblHL table.
4. In the Row Source field on the far right-hand side of the properties window, there is a ... button, click that.
5. you will see the list of table and queries that you have available.
6. select the tblHL table from the list, and click Add and then close.
7. Drag each field that you want to appear from the tblHL table on to the design area where it says fields making sure that whatever field is the Primary Key for the tblHL table is in the first column.
8. Once all that is filled in with all the items that you want to display, then click the close window button in the upper-right hand corner, and it will ask you if you want to save changes, just simply click on YES. and it will right the SELECT Statement into the Row Source field.
9. in the Column Count field, set the number of Columns that are being returned from the previous step and put that number into the Column Count field.
10. If you would like the field names to display, then the next property ( Column Heads) just simply set that to Yes. if you don't want them to display, then set it to No.
11. The next field is Column Widths. This is to set the width if each column that is being displayed from the table you defined in the row source field. by default, they are set to 1in.
12. The next and final field that you need to set, is to tell which column number from the columns being displayed from the tblHL table you want to store in tblCertData table for the value that you put into Control Source.
13. then close the properties window and see if that is what you want.

Hope that helps,

Joe P.
Nov 3 '08 #2

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

Similar topics

5
by: Jon | last post by:
I have a database that mysteriously takes information from fields in one clients record and places it into the fields of another client record. This happens sporadically. I end up finding data all...
8
by: Bri | last post by:
Greetings, I'm having a very strange problem in an AC97 MDB with ODBC Linked tables to SQL Server 7. The table has an Identity field and a Timestamp field. The problem is that when a new record...
6
by: GSteven | last post by:
(as formerly posted to microsoft.public.access.forms with no result) I've created a continuous form which is based on a straightforward table (ex - customers - 100 records). On the form there is...
1
by: ET | last post by:
Please help with the query: There are two tables, A and B. A table has information about cell phones, like cell number, sim number, model, manufacturer etc... B table has user related...
1
by: kkrizl | last post by:
I have a form that displays general information about an alarm permit location. There's a subform that shows detailed information about burglar alarms that have gone off at the location. When a...
5
by: robecflo | last post by:
Hi Forum, i have a problem, hope somebody can give me ideas. I'm developing with windows forms and vb.net, and oracle as a database. At this moment i have a table called amortizaciones, this table...
1
by: terry.statham | last post by:
Hope someone can help me here. I am fairly new to Access. I have set up a database relating to vehicle movements prior to sale. I have a subform based on 'locations' table which is linked to my...
4
by: banderson | last post by:
Hello, I am having a problem getting a new record in a subform to append to the underlying table. When I add a new record to the main form, the subform is blank, except for the ID field, which is...
6
by: JHite | last post by:
I'm using Access 2003 with MS XP. Have table/records with FirstName (text field), LastName (text field), plus other fields. User enters FirstName, LastName and other info in form. Before updating...
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
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
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...
0
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,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.