J
Jaybird
Apologies to everyone for the repost... I'm at my wits end on this. I hope
someone can help me.
This is not how a properly designed database is supposed to work, but our
database is sort of cobbled together and I'm kind of forced to go with the
flow. I have a main form frmInvoice. On it are two subforms, sbfInvoice and
sbfHDRPLAT. sbfInvoice is, as you might guess, a detail of the frmInvoice.
sbfHDRPLAT actually has a sub-subform called sbfLINPLAT that contains the
combobox [KEYNUM] and a textbox [LINETOTL]. Normally, the value of
[LINETOTL] is pretty straightforward, but when [KEYNUM] is equal to
"LINEITEM" I need the textbox [LINETOTL] to derive its value from a
calculation in sbfInvoice. The text box where this calculation takes place
is called txtTtlChrgs ([txtTtlChargs]=Sum([Charge])). The syntax of subform
references always throws me. Can anybody help point me in the right
direction? Corporate requires that this sum of charges be posted to our ERP,
so I'm kind of stuck. frmInvoice is designed to be an Invoice that
references Orders already in our database so that we don't have to use some
secondary or third party software. The subform controls have the same names
as the
subforms within them...
This is my code for the subform control sbfLINPLAT in the On Current event:
Private Sub Form_Current()
If IsNull([KEYNUM]) Then Exit Sub
If [KEYNUM] = "SURCHGE" Then [ACCTLAB] = "SC"
[ACCTPRE] = 3052
If [KEYNUM] = "CERT" Then [ACCTLAB] = "AL"
[ACCTPRE] = 3052
Me.LINETOTL = 10
If [KEYNUM] = "LINEITEM" Then [ACCTLAB] = "AL"
[ACCTPRE] = 3052
Me.LINETOTL = Forms!frmInvoice!sbfInvoice.Form!txtTtlChrgs
If [KEYNUM] = "INSPECT" Then [ACCTLAB] = "AL"
[ACCTPRE] = 3052
If [KEYNUM] = "STRAIGHT" Then [ACCTLAB] = "HT"
[ACCTPRE] = 3050
If [KEYNUM] = "AGING" Then [ACCTLAB] = "HT"
[ACCTPRE] = 3058
If [KEYNUM] = "OTHER" Then [ACCTLAB] = "OT"
[ACCTPRE] = 3510
If [KEYNUM] = "SOLUTION" Then [ACCTLAB] = "AL"
[ACCTPRE] = 3052
If [KEYNUM] = "FREIGHT" Then [ACCTLAB] = "FR"
[ACCTPRE] = 3521
Upon further reflection, it occurs to me that the On Current event is not
where this should occur. However, I'm not sure where it should go. If I
feed the value of [LINETOTL] in the AfterUpdate event of [txtTtlChrgs] it
seems logical that I would get the most up to date information, since those
calculations take place after most other events. But, I can't seem to get it
to work. Can anybody help me?
someone can help me.
This is not how a properly designed database is supposed to work, but our
database is sort of cobbled together and I'm kind of forced to go with the
flow. I have a main form frmInvoice. On it are two subforms, sbfInvoice and
sbfHDRPLAT. sbfInvoice is, as you might guess, a detail of the frmInvoice.
sbfHDRPLAT actually has a sub-subform called sbfLINPLAT that contains the
combobox [KEYNUM] and a textbox [LINETOTL]. Normally, the value of
[LINETOTL] is pretty straightforward, but when [KEYNUM] is equal to
"LINEITEM" I need the textbox [LINETOTL] to derive its value from a
calculation in sbfInvoice. The text box where this calculation takes place
is called txtTtlChrgs ([txtTtlChargs]=Sum([Charge])). The syntax of subform
references always throws me. Can anybody help point me in the right
direction? Corporate requires that this sum of charges be posted to our ERP,
so I'm kind of stuck. frmInvoice is designed to be an Invoice that
references Orders already in our database so that we don't have to use some
secondary or third party software. The subform controls have the same names
as the
subforms within them...
This is my code for the subform control sbfLINPLAT in the On Current event:
Private Sub Form_Current()
If IsNull([KEYNUM]) Then Exit Sub
If [KEYNUM] = "SURCHGE" Then [ACCTLAB] = "SC"
[ACCTPRE] = 3052
If [KEYNUM] = "CERT" Then [ACCTLAB] = "AL"
[ACCTPRE] = 3052
Me.LINETOTL = 10
If [KEYNUM] = "LINEITEM" Then [ACCTLAB] = "AL"
[ACCTPRE] = 3052
Me.LINETOTL = Forms!frmInvoice!sbfInvoice.Form!txtTtlChrgs
If [KEYNUM] = "INSPECT" Then [ACCTLAB] = "AL"
[ACCTPRE] = 3052
If [KEYNUM] = "STRAIGHT" Then [ACCTLAB] = "HT"
[ACCTPRE] = 3050
If [KEYNUM] = "AGING" Then [ACCTLAB] = "HT"
[ACCTPRE] = 3058
If [KEYNUM] = "OTHER" Then [ACCTLAB] = "OT"
[ACCTPRE] = 3510
If [KEYNUM] = "SOLUTION" Then [ACCTLAB] = "AL"
[ACCTPRE] = 3052
If [KEYNUM] = "FREIGHT" Then [ACCTLAB] = "FR"
[ACCTPRE] = 3521
Upon further reflection, it occurs to me that the On Current event is not
where this should occur. However, I'm not sure where it should go. If I
feed the value of [LINETOTL] in the AfterUpdate event of [txtTtlChrgs] it
seems logical that I would get the most up to date information, since those
calculations take place after most other events. But, I can't seem to get it
to work. Can anybody help me?