What is ownership: a table or a form? If it's a form, is it the form on
which the combo box exists as well?
If it's a table, is it the table that constitutes the recordsource for the
form on which the combo box exists?
You left out the Me's in your code: you need those to ensure that Access
realizes that you're talking about objects associated with your form, and
not variables.
Try:
Private Sub Partner_AfterUpdate()
Me![ptnr_ID] = Me!Partner
End Sub
If that doesn't work, post back, answering the questions above.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Sarah at DaVita said:
The name of the field I am updating is ownership.ptrn_id. The data I want in
that field is coming from partner addresses.ptrn_id. The name of the combo
box that I look up the data in is partner - it looks into the partner
addresses table for the ptrn_id. In the form I put in the combo box
representing the ownership.ptrn_id the following:
Private Sub Partner_AfterUpdate()
[Ownership]![ptnr_ID] = Partner
End Sub
It errors out. ??????
Thanks in advance for your help on this.
Douglas J. Steele said:
If you've got "=combobox11" as the control source of the text box, that's
why it's not going into your table.
Set the control source to the name of the field in the underlying recordset.
In the AfterUpdate event of the combobox, put something like:
Private Sub Combobox11_AfterUpdate()
Me.MyTextBox = Me.combobox11
End Sub
(replace MyTextBox with the appropriate name)
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
The user goes to the form and find the item they need in a drop down list.
So if they select 'Yada' and its UID is 17 I have put =combobox11 the
field
that corrasponds to the UID in the table I want updated. When I look into
the table after I save the record that column is null - UID 17 just shows
in
the form but doesn't get to the table. Confusing because I thought if you
see it in the form and save it will write to the table. I am fairly new
at
this so please excuse the rambling.
:
How are you prompting for the input now?
You may have to put code in your form to transfer that value to the
table.
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
The lookup I do now requires human intervention. If I do not get the
UID
stored as a forgein key in table b then everytime it is needed it will
require human intervention. I am taking two unrelated pieces of
information
and relating them for future use.
:
If you already have some means of looking up the value in the other
table,
you don't need to store the looked-up value as well.
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
message
Not duplicate data - I am looking up something in table a by its
description-
grabing the unique id and entering the unique id into table b.
:
Why do you want to duplicate data between the two tables?
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
in
message In a form I have a lookup in the header that goes to table a. In
the
detail
I then say another field is equal to the the field just looked up
in
table
a.
I want this to be entered into table b. The form returns the
data I
want
but will not enter the result into table b. Has anyone
experienced
this
before? If so, how did you overcome it?
Thanks
Sarah