Lookup on a subform

G

Guest

I have a subform that has 4 fields, 2 only relevant to this question, the
first is forename and second is surname, I have set forname to lookup its
info from another table and have set an afterupdate property so when they use
the lookup field it automatically fills the surname field. The code I have
used is;

Me.Surname = Me.Forename.Column(2)

This works fine, however it also add the surname to the row below which
would be the 'new row'.

How can I make it autofill only the relevant row?
 
G

Guest

Your sub form is Continuous form, and the field is unbound, so when you
assign a value to the field it automatically show it in all the records.
Instead of assigning the value to the Surname field after you update the
Forename, write in the ControlSource Property of Surname field
=Me.Forename.Column(2)
that way the field will be bounded to the column of the combo



Me.Surname
 
G

Guest

Thank you, got it sorted.

Ofer said:
Your sub form is Continuous form, and the field is unbound, so when you
assign a value to the field it automatically show it in all the records.
Instead of assigning the value to the Surname field after you update the
Forename, write in the ControlSource Property of Surname field
=Me.Forename.Column(2)
that way the field will be bounded to the column of the combo



Me.Surname
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top