473,851 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auto populate a field based on selection from Combo box

3 New Member
I have the need to populate a field based on the selection in a combo box.
Starting out simple. (2) tables tbl_OSE_Info and tbl_Input;
tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt
tbl_Input has three fields: OSE_Job, OSE_Name, OSE_Wt

I have populated tbl_OSE_Info table.
I need to create a form that will store the data in tbl_Input

I have racked my brain so much trying to figure out how to auto populate a field based on a combo box that I am now second guessing how I created the form.
I have created a form using the wizard.
"Choose the table or query where the object's data comes from:" tbl_Input
I added to the form:
Text field: OSE_Job
Combo Box: checked I want the combo box to look up the values in a table or query. Next>
Selected Table: tbl_OSE_Info, Next>
Selected All Available fields (Key, OSE_Name, OSE_Wt) Next>
Selected Hide key column (recommended) Next>
Selected Store that value in this field: OSE_Name
Labled the combo box OSE_Name.
Properties for Combo Box: cbo_OSE_Name
Name: cbo_OSE_Name
Control Source: OSE_Name
Row Type: Table/Query
Row Source: Select........
Column Count: 3
Column Heads: No
Column Widths: 0";1",1"
Bound Columns: 1

Added the Text field OSE_Wt to the form.
Saved the form as frm_Data

I need to populate the OSE_Wt field on the form base on a selection made in the combo box and have all the data stored in the tbl_Input form.

Please help before the rest of my hair falls out.
Oct 12 '07 #1
4 13981
nico5038
3,080 Recognized Expert Specialist
You can use the Combo's AfterUpdate event to move the values selected in the combo into the fields on your form. (I assume the form is based on the Target table!)
The general needed move for the first combofield is:
Me!fieldname = Me!Comboname.Co lumn(0)
for the second combofield use:
Me!fieldname = Me!Comboname.Co lumn(1)
The columns are so-called "zero based".
After the moves issue a:
Me.Refresh
This will force the new data to become visible.

Getting the idea ?

Nic;o)
Oct 12 '07 #2
whamo
3 New Member
You can use the Combo's AfterUpdate event to move the values selected in the combo into the fields on your form. (I assume the form is based on the Target table!)
The general needed move for the first combofield is:
Me!fieldname = Me!Comboname.Co lumn(0)
for the second combofield use:
Me!fieldname = Me!Comboname.Co lumn(1)
The columns are so-called "zero based".
After the moves issue a:
Me.Refresh
This will force the new data to become visible.

Getting the idea ?

Nic;o)
I receive this error:
Microsoft Access can't find the macro 'Me!OSE_Wt=Me!O SE_Name.'
The macro (or its macro group) doesn't exist, or the macro is new but hasn't been saved.
Note that when you enter the macrogroupname. macroname syntax in an argument, you must specify the name the macro's macro group was last saved under.
I have never used the 'Me' part so I am unsure what the error is telling me.
This is some of the information in my combo box:
Name: OSE_Name
Control Source: OSE Name
Row Source: SELECT [tbl_OSE].[Key], [tbl_OSE].[OSE_Name], [tbl_OSE].[OSE_Wt] FROM tbl_OSE;
After Update: Me!OSE_Wt=Me!OS E_Name.Column(2 )
Me!Refresh

Further assistance would be appreciated.
Oct 12 '07 #3
nico5038
3,080 Recognized Expert Specialist
You'll have to remove the statement from the textbox behind the afterupdate event first.
When the textbox is empty, double-click the AfterUpdate label.
Now the textbox will hold something like "Procedure" and there will be a [...] button at the end of the line when you single-click on the "Procedure" .
After pressing the [..] button the VBA editor will open and the cursor will be at the position where you need to place the statements I gave.
Close the code (top right [X] button) and save the form. Then try again.

Nic;o)
Oct 12 '07 #4
whamo
3 New Member
You'll have to remove the statement from the textbox behind the afterupdate event first.
When the textbox is empty, double-click the AfterUpdate label.
Now the textbox will hold something like "Procedure" and there will be a [...] button at the end of the line when you single-click on the "Procedure" .
After pressing the [..] button the VBA editor will open and the cursor will be at the position where you need to place the statements I gave.
Close the code (top right [X] button) and save the form. Then try again.

Nic;o)
AWSOME!!!!!! THANK YOU!!!!! THANK YOU!!!! THANK YOU!!!!!!!
Oct 12 '07 #5

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

Similar topics

3
12599
by: sao | last post by:
I am currently using Access 2000. In my table it is the following fields that are set up: 1 - Staff Name 2 - Department This table is already populated with 100+ records (staff along with department.)
4
4724
by: Sherwood Botsford | last post by:
Table Markers ID (Primary Key) This&That PointClass (Combo box) Points Table PointClasses PointClass (primary key) Points (number) Description (Text)
0
2035
by: BK | last post by:
Hi, I have a problem. I need to auto populate fields based on a value entered in combo box. Initially, I put all the required fields in the combo box, and hide it (set to 0",0",0", ...), then use code: Name=cbBox.column(3) to get the value. It works fine, but I have problem with performance. The source of the combo box is a table from another database that keeps adding up (currently we have around 1500 records, around 5-20 new records...
1
2365
by: Jim | last post by:
I have a new database in which I have a form where in one field I type a letter A, B, C or D and the field next to it autofills (auto lookups) with a description associated with the specific letter. If I edit the description for one record, it edits the same for all records in which I've applied the same autofill (auto lookup). I'm set up where the letters come from a lookup combo box (limit to list "Yes") and the record source for the...
3
7877
by: joseph.mccastlain | last post by:
Hello All, I am a new user to Access. I am currently designing a database consisting of four tables for multiple users. Rather than bore you with the goals and such, here is what I am attempting to do: I have two combo boxes, the first of which contains three text values (Org 1, Org 2, Org 3) and the second combo box contains a listing of 30 or so clients. I would like to condense the second combo box based upon the selection of the...
5
3918
FOE2272
by: FOE2272 | last post by:
I have tried every option that I can think of and most of them on this forum. The closest that I got was to bring up the field but it changed the other records based on what was chosen in one record. Details: DB with one main table and several list (reference) tables. I want to populate several list boxes on one form based on a choice from a combo box. Example: Tables:
4
3530
by: scolivas | last post by:
I think this is a me thing. but can't remember how to do it. I have a form that I am using and would like for a txt box to automatically populate based on what is selected in a combo box. here is what I have for form fields: Carton # <auto number> Item Title <txt> Item Accquisition Date <txt (date)> Is item consigned <yes/no>
2
3327
by: Ronald | last post by:
I hope somebody can help. I can't get into the specifics of my project, but I'll try to create a simple example: tblVehicle * VIN (text box) * Make (text box) * Model (text box) frmRepair
1
3201
by: cluless | last post by:
Hey everybody, I have a database with one major form that has a few subforms and a listbox, and on the form there are buttons that link to other forms as well. Once the list box is clicked on, the four subforms automatically populate based on the selection. The buttons that link to the other forms are designed to begin to add a record (based on what subform button was pressed). I want to find a way for the first field in the newly opened...
0
9897
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
9747
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
10670
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...
0
9506
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...
1
7906
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
5736
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
5933
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4549
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
3
3179
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.