populate data from another field

G

Guest

I have a forms using command buttons from a main client
form. I would like the linked forms to record the client ID from the
main form. I can currently get the linked form to display the client ID, but
I cannot get the linked form to save the client ID into the underlying data
source. All other data is saved in the underlying table. How can I save
the ClientID field to the underlying table after populating it from the main
table?
 
R

Ron2006

Mkilah said:
I have a forms using command buttons from a main client
form. I would like the linked forms to record the client ID from the
main form. I can currently get the linked form to display the client ID, but
I cannot get the linked form to save the client ID into the underlying data
source. All other data is saved in the underlying table. How can I save
the ClientID field to the underlying table after populating it from the main
table?

In the linked form in the beforeinsert event for the form:

me.linkedformclientIDfieldname =
forms![Mainformname]![ClientIDFieldName]


Ron
 
G

Guest

Ron
Thanks.

I tried, doesn't work. Are there any other thoughs? All data saves except
for the clientid field that populates the id number from the main form. If
it's helps, I have a main form that I clicks a command button to open up the
linked form. All records related to that ID number appears. Then when I
click select to enter a new record, ID number appears in the new record but
when I enter all other data and save the record and closes it, all data saves
to table except for the ID number field. Also on the linked table, I have
the following code in the ClientID field to populate the new records:
=forms!personal!clientid.

Appreciate any support.

Ron2006 said:
I have a forms using command buttons from a main client
form. I would like the linked forms to record the client ID from the
main form. I can currently get the linked form to display the client ID, but
I cannot get the linked form to save the client ID into the underlying data
source. All other data is saved in the underlying table. How can I save
the ClientID field to the underlying table after populating it from the main
table?

In the linked form in the beforeinsert event for the form:

me.linkedformclientIDfieldname =
forms![Mainformname]![ClientIDFieldName]


Ron
 
R

Ron2006

In/On your subform

Sit on the field that is suppost to have the ClientID in it
Go to Properties
Data Tab

What is the value in the line called ControlSource?

It should be the field name of the child table that is supposed to have
the parent control ID in it.

Ron
 
G

Guest

Thanks.

That worked. The clientid field was unbonded. That's where I had the code
to populate the clientid to the new form when open. I changed the control of
the clientid to a bound field and placed my code in the default event of its
field to populate the clientid to the new form. Hope there is no drawback to
the default field code.
Thanks again.
 
R

Ron2006

If by default event you mean default value, I guess that will work.

I think it may have the drawback that if you sit on a new record, it
will create it automatically, because you have the default value where
as if you load it in there in the before insert event then you will
only create a new record when you have changed/put a value in some
other field. I have never used the default value that way, you may want
to try it out.

To test it simply sit on a new record and then back up to the prior
record and see if you are stuck with an empty record.

I am using deductive reasoning on this one, which may or maynot be
correct. I have never used that part of the properties area.

Please let me know how that works out.

Ron
 
R

Ron2006

I tried to setup what I think is a similar situation, and it seemed to
work just fine. So my deduction may be incorrect. Best thing is for you
to try it out .

Ron
 
G

Guest

Ron,

It works perfectly. That was my goal for the value to show up in the new
record. And to answer your question about having a blank record the answer
is no. I only get a blank record if I enter data in another field which then
activates the autonumber field. I believe also, when I was testing, I was
able to click the undo menu button and the record did not save.

Thanks for your support of my question.
 

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