If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
populate data from another field
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? |
#2
|
|||
|
|||
populate data from another field
Mkilah wrote: 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 |
#3
|
|||
|
|||
populate data from another field
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" wrote: Mkilah wrote: 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 |
#4
|
|||
|
|||
populate data from another field
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 |
#5
|
|||
|
|||
populate data from another field
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. "Ron2006" wrote: 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 |
#6
|
|||
|
|||
populate data from another field
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 |
#7
|
|||
|
|||
populate data from another field
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 |
#8
|
|||
|
|||
populate data from another field
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. "Ron2006" wrote: 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 |
Thread Tools | |
Display Modes | |
|
|