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

Populating a Field with info from another table

I keep getting a syntax error when I try to create the procedure to insert the information selected from the list box into the main database. The data in the list box comes from a separate table with only 2 field. The user can check the selections in the form, but the selections aren't saving in the main table. The Form allows user entry to populate the "Colleges" table. The "Majors" table has a list of majors that appears on the form. Users can check the ones that apply. I want the items checked to be inserted in the (majors_field) in the colleges table. How do I accomplish this?
Oct 30 '11 #1
5 1576
NeoPa
32,556 Expert Mod 16PB
The form wizard should help with this Joyce. It seems you're approaching it in a common, but flawed way.

If the form is to update the [Colleges] table then create a form that maintains (Add/Edit/Delete/Etc) that table. This form would need a ComboBox control from which you could select an ID of one of the items in the list. You shouldn't be thinking of copying two fields across as that goes againtst the concept of Normalisation which is fundamental to database design (See Database Normalisation and Table structures).
Oct 31 '11 #2
Thank you for your reply. Perhaps I wasn't clear.

The form I am using is created to add/edit/delete, the "Colleges" table. I'm simply using the list from the "Majors" table as a ComboBox, and attempting to allow users to make a selection that gets saved in "colleges". Right now users can make the selection but it is not being stored in either table. The ID selection is also not being saved in the "Colleges" table so the [major] field in that table remains blank when I go to view it.

I have already added a field in this form that allows users to "add" a degree major to the "Majors" table, and also updates the [major] field in the "Colleges" table.
Oct 31 '11 #3
NeoPa
32,556 Expert Mod 16PB
If the ComboBox control (not field) returns a [Majors] ID then simply bind this to the [Major] (ID) field of the form (whose Record Source is [Colleges]). You should probably understand that forms have controls and fields, but these items are not synonymous. A control (TextBox; ComboBox; Label; etc) shows data on the form, while a Field holds the data as part of the Record Source recordset.

Joyce Fife:
I have already added a field (control) on this form that allows users to "add" a degree major to the "Majors" table, and also updates the [major] field in the "Colleges" table.
It's probably not a great idea to manage a separate table on the same form, but what you say implies you already have a solution. If you can already maintain the [Major] field of [Colleges] why are you asking how to add new ones?
Oct 31 '11 #4
OK, thanks again. I will look into the "binding" step. The intent is that the [Colleges] table is updated with the selected major from the [Majors] table, but that's not happening when I attempt the updating using the form. It does update when I use the Datasheet View and make the selection.

I'm sure it's something simple that I've done wrong or overlooked, but without experience it's been difficult knowing where to check for my mistake.
Oct 31 '11 #5
NeoPa
32,556 Expert Mod 16PB
Forms are bound to record sources by specifying them in the form's Record Source property. Controls are bound to fields by specifying the field in the control's ControlSource property.

To understand the process better the ComboBox is simply setting the value of the bound field to the value selected from the ComboBox. When this is on a New record then that value will be saved into the record as [Colleges].[Major]. Does that make better sense?
Nov 1 '11 #6

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

Similar topics

1
by: Tony Johnson | last post by:
I want to update a particular field in a form for only a certain set of records. The certain set of records is named Financed. I need to update those Financed records with a financed number that...
0
by: Kosmos | last post by:
Okay so the following is a question I posted earlier...to clarify what I'm trying to do here...I simply want the printed output to be put into a new field in a different table that's already created...
4
by: PRLIT | last post by:
First, let me just say that I've been looking at this site for help for awhile now. Thank you for all the help you given me over the past few months. Second, I'm creating a form in Access 2007. I...
3
by: webcat | last post by:
this is crazy, why can't i get this to work?!! i have a complex DB with many tables, but the ones that count here are: a linked SQL table with many records and a field called userEmail ...
7
by: sailor152 | last post by:
I am having two tables, table A has the following fields: cust_ID, email Table B has the following fields: ID, email, name I want to move email from Table A to B when the cust_ID = ID. Please...
2
by: Hillwalker | last post by:
Hi Raw recruit, no VB knowledge but some general programming experience..... Access 2000 on XP In form view, I wish to fill the field (ONLY on the record being viewed) with the maximum value...
3
by: ghost1980 | last post by:
hi there, i am new to ms access and currently i am in need of help. here is my problem i need to help create a form that allow me to update 2 tables. example: PERSON1 (table 1) id name dob...
23
by: SusanK4305 | last post by:
I have a DB table that is linked to my new DB. I can't edited the linked table. So I created another DB w/ additional data however I still need to pull data over from one to the other. My DB has 2...
0
by: John Bloor | last post by:
I have a Microsoft Access 2007 database that uses a form whose recordset is a products table that contains an attachment field. From that form, I need to be able to append the current record to...
6
by: Lisa B | last post by:
I have created a combo box SELECT Vendeurs.VendeurID, Vendeurs., Vendeurs. FROM Vendeurs GROUP BY Vendeurs.VendeurID, Vendeurs., Vendeurs.; This successfuly returns the first name and last...
1
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: 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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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...

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.