How to add values to a field in a subform

M

Maran

I want the data in the Main form to be updated on the Subform, when I tick a
Check Box in the Sub form.

I have a main form named as Payment Details, which has the Cheque No. I have
a sub form,named as Invoices, which lists out all the pending Invoices. I
have a Text Box and a Check Box in the Sub Form against all Invoices. I want
the Text box to be updated with the cheque no, when I tick the cheque box.
Please help. Thanks.
 
T

Tom Lake

I want the data in the Main form to be updated on the Subform, when I tick
a
Check Box in the Sub form.

I have a main form named as Payment Details, which has the Cheque No. I
have
a sub form,named as Invoices, which lists out all the pending Invoices. I
have a Text Box and a Check Box in the Sub Form against all Invoices. I
want
the Text box to be updated with the cheque no, when I tick the cheque box.
Please help. Thanks.

In the On Click event of the check box, put the following code

Me![TextBoxName] = [MainFormName]![ChequeNo]

Replace TextBoxName with the name of the control in the subform
to be filled in, MainFormName wiith the name of your main form,
and ChequeNo with the name of the control on the main form that
has the Cheque Number in it.

Tom Lake
 
S

Steve Schapel

Maran,

If I understand you correctly, you would use the After Update event of
the checkbox, and code something like this...
Me.NameOfYourTextbox = Parent![Cheque No]

However, at a tangent to your main question, it may be worth reviewing
your table/form design. First of all, it would be very unusual, in a
properly designed database, to need to record a cheque number in two
places like this. And secondly, your design would imply one payment
being made to cover multiple invoices... is that correct? In most of my
databases, it's the other way around, i.e. provision needs to be made
for possibly multiple payments against one invoice.
 

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