Question : AutoFill field when a selection is Selected

Hi,

We have this Access database Form and one field with a drop down box. the table of the selection is in this form.

Selection.Field1 = NAME
Selection.Field2 = Description

and we will select Selection.Field1 records to go to the drop down selection which is Main.Field2.

The main table is in this format.

Main.Field1 = Number
Main.Field2 = Name
Main.Field3 = Description
Main.Field4 = Date

If we select the Name from the drop down menu which contains all records in  Selection.Field1 we want the Selection.Field2 (description) for the selected Selection.Field1 record to be automatically placed in the Main.Field3. How can we do this?

Thanks!

Answer : AutoFill field when a selection is Selected

Well a quick way is to use the afterupdate event of the combo (drop down) box

e.g.

sub mydropdown_afterupdate()
If isnull(me.mydropdown) then exit sub
Me.Field3 = Me.mydropdown.column(1)   'this is the second column in the dropdown
End Sub

(assuming your drop down box is named mydropdown)

However, i'm not sure if your requirement is to move to the appropriate record in the main table first, but in that case the description would already be present so the update would be meaningless... so I'm hoping the above solution will help...




Random Solutions  
 
programming4us programming4us