Writing a Query

deepakgoyal

Registered User.
Local time
Tomorrow, 03:46
Joined
May 31, 2006
Messages
12
Hi

I have three fields on the form. First one is Combo box - "Contact person", Second - "Code" is Text field, Third - "Department" is the text field. Corresponding to this I have a table "Department "with fields Contact person, Code, Department.

I want that when I select the Name from the combo box, corresponding records like Code and Department should appear in the respective text box.

Help me in writing this code.

Thanks in Advance Very much
Deepak
 
The data you wish to copy must be present in the combo box even if it's not visible.

Right click the combo box and select Build Event, then Code Builder.

In the Before Update section of the combo box enter the following code above the "End Sub".

The columns of the combo box are numbered starting with 0 (zero) at the extreme left and increasing by one with each column you move to the right.


[fieldname] = ([Combo#],0)

the fieldname is the field you wish to save the data to
Combo# is the number of the combo box
0 is the number of the column that contains the data.

Use the same code for each column of the combo box you wish to save to a field.

If you used the wizard to create the combo box and selected a column to save data to, you do not have to include it in the coding.
 
do not reply to this thread it is a pentuple (five time) post
 

Users who are viewing this thread

Back
Top Bottom