Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Flag for Zambia asked on

VBA requirements

I have done a simple payroll for a small company and it working fine. Now in the sub report where we capture deductions , such as loans & advances I just want all the  deduction to be captured in one line and at the end of the line access should not allow the courser to go to the second line.

How can I archive that by using VBA??????????

I do not want to start summing data again because it will changing a lot of objects, any help on this will be highly appreciated.

Regards

Chris
Microsoft AccessVBA

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
John Tsioumpris

Without knowing the exact structure of your report/subreport a possible solution would be to add a group on your subreport and on the footer
 of the group perform the sum of the deductions
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc

ASKER
Sorry may be I was not clear here, what I'm saying is that I have a subform attached to the parent form, now in the subform instead of having endless number of lines or rows created I want to limit the rows to one. Here is the code I'm trying but I seam not to get it right , may be Im making a mistake some where, please check:

Private Sub Form_BeforeInsert(Cancel as Integer)
If DCount("*", "[childtable]", "[ID] = " & Me!ID) >= 1 Then
MsgBox "Only one records allowed", vbOKOnly
Cancel = True
End If
End Sub


Please note Child table represent table name attached to the subform

Regards

Chris
ASKER CERTIFIED SOLUTION
Dale Fye

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61