Here is hope it's not too illogical, i'm more of a beginner at coding.
How can I get info when a filter is applied to a form and I am currently on FIRST record. How to obtain this property? After that I could apply that info in my code.
Thank you.
Code:
Private Sub PostVATID1_Click()
'' FIRST ROW:
'1.a) Set focus to (first) New record in GL subform
Forms!EntryHead!GeneralLedger.SetFocus
'1.b) Copy from Main Form to the first row Record in a subform GL:
Forms!EntryHead.GeneralLedger.Form.Account = Forms!EntryHead.Account
Forms!EntryHead.GeneralLedger.Form.CustCode = Forms!EntryHead.CustCode
Forms!EntryHead.GeneralLedger.Form.Refer = Forms!EntryHead.Refer
Forms!EntryHead.GeneralLedger.Form.Debit = Forms!EntryHead.Debit
Forms!EntryHead.GeneralLedger.Form.Credit = Forms!EntryHead.Credit
Forms!EntryHead.GeneralLedger.Form.Narration = Forms!EntryHead.Narration
'2. Go to the next (second row) Record in a subform GL
On Error Resume Next
Forms!EntryHead.SetFocus
Forms!EntryHead!GeneralLedger.SetFocus
DoCmd.GoToRecord
Me.SetFocus
'' SECOND ROW:
'3. Copy from Main Form to a subform GL (second record):
'copy from Main Form (Refer, Narration)
Forms!EntryHead.GeneralLedger.Form.Refer = Forms!EntryHead.Refer
Forms!EntryHead.GeneralLedger.Form.Narration = Forms!EntryHead.Narration
'4. Copy from VAT Form (COST):
If cmbVATtr.Value = 0 Then
'copy from VAT form COST data(account,amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.ContraAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.NetValue00
ElseIf cmbVATtr.Value = 1 Then
'copy from VAT form COST data(account,amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.ContraAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.NetValue
On Error Resume Next
Forms!EntryHead.SetFocus
Forms!EntryHead!GeneralLedger.SetFocus
DoCmd.GoToRecord
Me.SetFocus
'' THIRD ROW:
'copy from Main Form (Refer, Narration)
Forms!EntryHead.GeneralLedger.Form.Refer = Forms!EntryHead.Refer
Forms!EntryHead.GeneralLedger.Form.Narration = Forms!EntryHead.Narration
'copy from VAT Form VAT data (VAT acc., VAT amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.VATAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.VatValue20
ElseIf cmbVATtr.Value = 2 Then
'copy from VAT form COST data(account,amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.ContraAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.NetValue
On Error Resume Next
Forms!EntryHead.SetFocus
Forms!EntryHead!GeneralLedger.SetFocus
DoCmd.GoToRecord
Me.SetFocus
'copy from Main Form (Refer, Narration)
Forms!EntryHead.GeneralLedger.Form.Refer = Forms!EntryHead.Refer
Forms!EntryHead.GeneralLedger.Form.Narration = Forms!EntryHead.Narration
'copy from VAT Form VAT data (VAT acc., VAT amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.VATAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.VatValue10
ElseIf cmbVATtr.Value = 9 Then
'copy from VAT form COST data(account,amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.ContraAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.NSV
End If
End Sub
Private Sub PostVATIDx_Click()
'2. Go to the NEXT Record in a subform GL
On Error Resume Next
Forms!EntryHead.SetFocus
Forms!EntryHead!GeneralLedger.SetFocus
DoCmd.GoToRecord
Me.SetFocus
'3. Copy from Main Form to a subform GL (second record):
'copy from Main Form (Refer, Narration)
Forms!EntryHead.GeneralLedger.Form.Refer = Forms!EntryHead.Refer
Forms!EntryHead.GeneralLedger.Form.Narration = Forms!EntryHead.Narration
'4. Copy from VAT Form (COST):
If cmbVATtr.Value = 0 Then
'copy from VAT form COST data(account,amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.ContraAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.NetValue00
ElseIf cmbVATtr.Value = 1 Then
'copy from VAT form COST data(account,amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.ContraAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.NetValue
On Error Resume Next
Forms!EntryHead.SetFocus
Forms!EntryHead!GeneralLedger.SetFocus
DoCmd.GoToRecord
Me.SetFocus
'copy from Main Form (Refer, Narration)
Forms!EntryHead.GeneralLedger.Form.Refer = Forms!EntryHead.Refer
Forms!EntryHead.GeneralLedger.Form.Narration = Forms!EntryHead.Narration
'copy from VAT Form VAT data (VAT acc., VAT amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.VATAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.VatValue20
ElseIf cmbVATtr.Value = 2 Then
'copy from VAT form COST data(account,amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.ContraAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.NetValue
On Error Resume Next
Forms!EntryHead.SetFocus
Forms!EntryHead!GeneralLedger.SetFocus
DoCmd.GoToRecord
Me.SetFocus
'copy from Main Form (Refer, Narration)
Forms!EntryHead.GeneralLedger.Form.Refer = Forms!EntryHead.Refer
Forms!EntryHead.GeneralLedger.Form.Narration = Forms!EntryHead.Narration
'copy from VAT Form VAT data (VAT acc., VAT amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.VATAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.VatValue10
ElseIf cmbVATtr.Value = 9 Then
'copy from VAT form COST data(account,amount)
Forms!EntryHead.GeneralLedger.Form.Account = Me.ContraAccount
Forms!EntryHead.GeneralLedger.Form.Debit = Me.NSV
End If
End Sub