Copy record within the subsorm

raghuprabhu

Registered User.
Local time
Today, 03:31
Joined
Mar 24, 2008
Messages
154
Hi All,
I have uploaded a small database. I keep track of payments for people who receive a language proficiency allowance. Usually the members receive this allowance for two years. Sometimes they receive it for one year.
Lang Level DateQuaFrom DateQuaTo DatePd From DatePd To
Hindi Inter 15-Dec-12 14-Dec-14 15-Dec-12 14-Dec-13
Hindi Inter 15-Dec-12 14-Dec-14 15-Dec-13 14-Dec-14

There is a field called NoOfPays . If this field value is 2 in the first record then I want it to insert a second record as shown above. How do I do it. I tried to append but it is not working.
Now copying the record with the maxID is not correct.
Thanks in advance.
Raghu Prabhu
 

Attachments

...
There is a field called NoOfPays . If this field value is 2 in the first record then I want it to insert a second record as shown above.
When/how should it be insert?
 
Got it working a bit, but, have a look at the attachment Please.
When I input No. Of Payments equals to 2, it is prompting me to input the IDLPA, how do I get around it? It has to pick up the IDLPA automatically.
Thanks
Raghu Prabhu
 

Attachments

Yes you need to point to the "main" form before you point to control on it.
[Forms]![frmMain]![subFrmLPA].[Form]![IDLPA]
 
Thanks JHB, but it is taking 2 attempts for it to work. I don't know why.

Regards

Raghu Prabhu
 
Because the record isn't saved yet when you run the update query, therefore you must set Me.Dirty = False.

Code:
Private Sub noOfpays_AfterUpdate()

    Select Case noOfpays
        Case 1
            'do nothing
        Case 2
            Me.Dirty = False
            DoCmd.OpenQuery "Query1", acViewNormal, acEdit
            Me.Requery
    End Select
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom