iceneweb
03-01-2001, 05:59 PM
I am trying to accomplish the following with VBA:
When the user moves to a new record the new record date should be incremented by 1 from the previous record date.
This is how far i've got:
I have declared a global variable for the OrderDate and used the following code to take the date from the old record, put it into the variable from which the new record takes it's 'OrderDate' value:
Private Sub Form_AfterUpdate(Cancel As Integer)
' store the existing date in a globally available variable
strOrderDate = Forms!frm_orders!OrderDate
End Sub
Private Sub Form_AfterInsert()
' add the date on the new record from a globally available variable and increment by a month
Forms!frm_orders!OrderDate = DateAdd("m", 1, strOrderDate)
End Sub
Now, I feel totally lost with this, it's not working for me and is probably blindingly obvious to you.
Anyone got any ideas?
Thanks a lot,
Mark
When the user moves to a new record the new record date should be incremented by 1 from the previous record date.
This is how far i've got:
I have declared a global variable for the OrderDate and used the following code to take the date from the old record, put it into the variable from which the new record takes it's 'OrderDate' value:
Private Sub Form_AfterUpdate(Cancel As Integer)
' store the existing date in a globally available variable
strOrderDate = Forms!frm_orders!OrderDate
End Sub
Private Sub Form_AfterInsert()
' add the date on the new record from a globally available variable and increment by a month
Forms!frm_orders!OrderDate = DateAdd("m", 1, strOrderDate)
End Sub
Now, I feel totally lost with this, it's not working for me and is probably blindingly obvious to you.
Anyone got any ideas?
Thanks a lot,
Mark