Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the On Click Event

Status
Not open for further replies.

integritycare

Technical User
Mar 12, 2011
151
AU
Hi

Just have a minor issues with getting some data from a subform to the mainform.
The issue is that on the client form a single client can have many Contract No's. This data is found on the subform. There is a text field on both the forms [ContractNo]. The user needs to be able to just click on the subform control [ContractNo] and for it to insert that into the mainform control[ContratcNo] then the user can generate the invoice.
The code I have tried is this;
Code:
Parent.[ContractNo] = [Form18].[Form]![ContractNo]
but just can not get it to work.
The Subform name is [form18] and the Mainform is [frmClient_Invoice]

Any help would be appreciated.


Integrity
 
Although what you want to do makes little sense. I cannot think of a logical reason to push child record information to the parent table. Your tables are not structured correctly. With that said, if you really had to do it.

code in the sub form
me.parent.contractNo = me.contractNo

If you wanted to do it from the mainform
me.contractNo = me.form18.form.contractNo
 
Hi MajP,
Thank you for your reply.
The main reason for this is that the client form has been built with the main client data on the mainform and all contract data on the subform. The links are by ClientID. Each Client can have up to 10 or so contract nos. As the invoices are created by code from the mainform there is a requirement for the contract no to be on the invoice report. The users who do the invoices are incorrectly putting the wrong contract no on the invoice. I had though of using a combo box on the mainform which would select the client and the associated contract nos from the subform, but was not sure if this was the better way to do it.
Any sugesstions would be aapreciated.

Integrity
 
How are ya integritycare . . .

Agree with [blue]MajP[/blue]. Your working backwards as far as tables & relationships are concerned. Main forms control subforms, not the other way around.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hi The AceMan1,
I would also agree with both of you. I know that there should be a seperate table to hold contract numbers and relate that to the client table, but with the amount of data in the system, it would be quite time consuming to do this. The DB has been desighned for the medical field. To change tables and relationships now would take some time. So I was loooking for a quick fix....
Is that what you would Do?

Integrity
 
New Postintegritycare said:
[blue]Is that what you would Do?[/blue]
No!
New Postintegritycare said:
[blue]As the invoices are created by code from the mainform ...[/blue]
I don't understand why you don't simply pickup [blue]ContractNo[/blue] from the selected record in the subform, during generation of invoice?

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
The TheAceMan1,

Thanks,Now thats a thought I will look at. But as I will be looking at changing anothers programming.... Its just the way it has been set up initially.
But you have given me some room for thought.

Many thanks

Integrity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top