Expression

M

myxmaster

Thanks to Fred I have almost resolved this issue. The only problem is
If I enter the transactionType (Withdrawal-Deposit), after I have
entered the amount, regardless of the choice made the amount number
stays at a positive amount.


f IsNull([Transaction Type]) Then
MsgBox "You Must select either Withdrawal or Deposit."
Exit sub
End If
If Me.[Transaction Type] = "Deposit" Then
If Me.[Amount] >0 Then
Me.[Amount] = Me.[Amount] * -1
End If
Else
If Me.[Amount] < 0 Then
Me.[Amount] = Abs(Me.[Amount])
End If
End If
TIA
 
F

fredg

Thanks to Fred I have almost resolved this issue. The only problem is
If I enter the transactionType (Withdrawal-Deposit), after I have
entered the amount, regardless of the choice made the amount number
stays at a positive amount.

f IsNull([Transaction Type]) Then
MsgBox "You Must select either Withdrawal or Deposit."
Exit sub
End If
If Me.[Transaction Type] = "Deposit" Then
If Me.[Amount] >0 Then
Me.[Amount] = Me.[Amount] * -1
End If
Else
If Me.[Amount] < 0 Then
Me.[Amount] = Abs(Me.[Amount])
End If
End If
TIA

Probably more than one way to take care of this.
Easiest for me is to simply Lock the [Amount] control in it's
AfterUpdate event, and unlock it in the [Transaction Type]
AfterUpdate event.
Therefore the user cannot enter data into the Amount control unless
he/she has first chosen Withdrawal or Deposit.
Also place the [Transaction Type] control earlier in the Form Tab
order so as the user enters data in the other controls, it will be
selected before the Amount control.

First set the Amount control's Locked property to Yes.
Then code the [Transaction Type] AfterUpdate event:

Private Transaction_Type_AfterUpdate()
Me.[Amount].Locked = False
End If

Private Amount_AfterUpdate()
If ...
' Do your current code here
End If

Me.[Amount].Locked = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Expression 0
Calculating transactions by time 3
Is this possible 4
Dsum cont: 1
Expression help continued 1
Reference number 8
Expression subtracts double 4
VBA Coding Help for Beginner 0

Top