Access 2000 Select Case: - TechRepublic
General discussion
March 13, 2001 at 04:38 AM
donq

Access 2000 Select Case:

by donq . Updated 25 years, 3 months ago

I have a combo text box named ?gjFKcoa? on a Form (named ?GJMaint”) that stores General Journal account numbers (or expense or revenue account names). These names begin with ?E? or ?R? respectively and I need to execute a select case based on that letter. I initialize my procedure variable as follows:

Dim AT As String
AT = Left([gjFKcoa],1)

Additionally the Expense or Revenue amount is stored in a currency field named ?gjAmt? and offsetting (ledger) Asset, Capital, Liability, and Other(Chart of Account) revenue amounts may be entered on the same form in a field named ?gjOAmt1? (for offset amount 1). When a Revenue amount is entered (in gjAmt) I need [gjAmt]-[gjOAmt1] = True, and when an Expense is entered I need [gjAmt]+[gjOAmt1] = True.

I tried:

Private Sub Form_AfterUpdate()

Dim AT As String
AT = Left([gjFKcoa],1)

If [gjOAmt1] <> Null Then ?If anyone enters an offset value.

Select Case AT

Case ?E?
[gjAmt]+[gjOAmt1] = 0 ?make sure expenses sum to zero.
Case ?R?
[gjAmt]-[gjOAmt1] = 0 ?make sure revenues offset to zero.
Case Else
Msgbox ?A positive Expense entry requires an equal negative offset, and a positive Revenue entry requires an equal positive Asset or Capitol offset.?
End Select
Else
End Sub

End If

End Sub

I just can’t get the thing to work – any help would be greatly appreciated.

This discussion is locked

All Comments