auto populate a form from a combo box (1 Viewer)

Joeman2020

New member
Local time
Today, 18:17
Joined
Jun 2, 2020
Messages
12
Hi Access World,
First post here. I am trying to auto populate a form from one combo box. For example I would like to select item name and have it automatic put in the category, room, location, price per item, quantity in stock, and quantity sold. Also, when I select the vendor id it would put in the vendor name. Not sure if this can be done or not. Thanks for your time and help. Joe, Michigan.
 

Attachments

theDBguy

I’m here to help
Local time
Today, 15:17
Joined
Oct 29, 2018
Messages
10,764
Hi Joe. Welcome to AWF!

You can do this; but normally, you wouldn't, because you shouldn't store duplicate information in multiple tables. Instead, you would just store the primary key value in a foreign key field. What database are you trying to create? I didn't see any combobox on your form.
 

plog

Banishment Pending
Local time
Today, 17:17
Joined
May 11, 2011
Messages
9,895
I am trying to auto populate a form from one combo box.
My guess is you want to have 1 form (F1) open a second form (F2). F1 would have a drop down of all items and a button. User would select an item, click the button and F2 opens with that item's data. Correct? If so, build F1, then you will use the DoCmd.OpenForm method on the button's code to achieve what you want:


Also, when I select the vendor id it would put in the vendor name.
You don't achieve what you want with this method. Instead you create 1 drop down for the vendor. It would show the vendor name, but use the VendorID. That means you only have 1 field for Vendor on F2. This link will help you with that:


Lastly, you need to fix your tbllabsupplies. You've made a few mistakes:

1. [Quantiy in Stock] & [Quantity Sold] are Short Text values. Change them to numeric.

2. You don't need [Payment Received]. If [Payment Recieved Date] has a value, then you know it was received.

3. You don't need [Vendor Name]. As DbGuy mentioned you don't store duplicate data. You store just the primary key of a table in a foreign location. Then when you need data from both tables you crreate a query and JOIN the tables to get all relevant data.

4. Only use alphanumeric characters in names. Spaces and weird characters just make coding and querying harder, don't use them. So instead of [Date Sold] use [DateSold].
 

Joeman2020

New member
Local time
Today, 18:17
Joined
Jun 2, 2020
Messages
12
Hi, Here is my database with the combo box in it. Except I don't think it's working because when I try to click on the item its not registering in the box.
 

Attachments

Joeman2020

New member
Local time
Today, 18:17
Joined
Jun 2, 2020
Messages
12
Hi Plog and Db Guy,
Thank you for replying to my post. I'm just starting out with Access so l'm a bit of a novice. Any help to improve this data base would be greatly appreciated.
 

plog

Banishment Pending
Local time
Today, 17:17
Joined
May 11, 2011
Messages
9,895
Your prior 2 posts seem dismissive or oblivious to my detailed post of instructions.
 

Joeman2020

New member
Local time
Today, 18:17
Joined
Jun 2, 2020
Messages
12
I made the adjustments according to your post, thanks plog
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom