473,466 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Create 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 13935
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.Column(0)
for the second combofield use:
Me!fieldname = Me!Comboname.Column(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.Column(0)
for the second combofield use:
Me!fieldname = Me!Comboname.Column(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!OSE_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!OSE_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
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...
4
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
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...
1
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...
3
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...
5
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...
4
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...
2
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
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...
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
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...
1
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...
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...
0
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...
0
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 ...

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.