Automatic data fill in

mitch_moseley

New member
Local time
Today, 20:10
Joined
Nov 12, 2014
Messages
5
In my subform I have 3 boxes: Product ID, Desciption and retail price. I have a combo box that lets you select the Product ID. Is there a way to make it that when I select the customer ID, the description and retail price appears as well?
 

Attachments

  • ict.jpg
    ict.jpg
    98 KB · Views: 143
Yes. In the On_Change event for the combo box, you can use Dlookup code to assign values to your textboxes.
 
I am not very familiar with Dlookup code, is there a website that can help me?
 
customer ID, the description and retail price appears as well?
you mean Product ID?

Best way isnt with DLookup, avoid those as the plague they are!
You hopefully are NOT using an ID field to display in your database? IDs usually are random numbers that mean little or nothing to us humans and should be used inside the database hidden from our eyes.
Anyways as for your problem, you can add the columns you want as hidden columns to your combobox and use an event (after update) to fetch the hidden values and write them on screen.

The combobox is a zero based array, meaning the first column is 0...
In below example I am fetching the second column.
Me.Decription = me.cbobox.columns(1)

Good luck !
 
In your combo you can have multiple columns.
Put the Id as the 1 st. column (column 0) and set its width to be zero.
Your combo ColumnsWidth setting should look like: 0 cm;2 cm; 2 cm
Use the AfterUpdate code namliam gave to put the data into the text box.
 

Users who are viewing this thread

Back
Top Bottom