View Full Version : The previous answer just confused me more! Aargh! Please Help!


Gram123
01-17-2001, 11:03 PM
I realise this has been answered, but I didn't undrestand the answer!

I NEED TO HAVE A TEXT BOX AUTOMATICALLY INSERT TEXT WHEN I ENTER A CODE FROM AN ADJACENT COMBO BOX.

I have to program a database at work (within the next 8 hours), which must include lots of fields that have a code number and a name, for example, Ship Number and Ship Name.
I have a Main table containing all required fields on the form and a second table containing all possible ship names and numbers.
On the form, I have a combo box based on the Ships Table. It displays both columns, so the person entering the data can click the drop-down box and select the code if they know the ship name. I need the ship name to then enter automatically in an adjacent text box. Assuming the form is called Ships, how do I do this?

On a database programmed by someone else, they use a subform, but I've never had to use subforms, and it doesn't seem to work when I try importing it and substituting names.
Can I achieve this auto-fill without a subform?
Do I need to create a query for the Ship Name text box?

Please answer in a STEP BY STEP way, because although I work as a I.T. guy, I have learned Access without any documentation and don't understand some of the terms used! Bear in mind that I don't know visual basic/sql.

PLEASE E-MAIL ME WITH ANY ANSWERS ON:

graham.cat@hslltd.co.uk

Thanks for any help.

ntp
01-18-2001, 02:49 AM
If you have a combo control called with two columns in each ow being displayed (ShipCode and ShipName), you can use the combo's AfterUpdate event to set the value to be displayed in the text control.

e.g.

Private Sub cboShipList_AfterUpdate()
' Assuming that the columns are displayed in the order ShipCode then ShipName
me.txtShipName = me.cboShipList.Column(1)
End Sub

I'll also e-mail you the information incase you don't read this before your 8 hours are ended.


ntp