QBF VB

T

TechTutors

Hello Everyone!

To begin with, I would like to thank you all for taking the time in
assisting me! Your help is very much appreciated!

I have a field that contains both negative and positive numbers ((set to
currency to represent (-) credits and (+) debits)). My client would like to
run a few different custom searches. The first search could translate to
something like this ::: >= 500 OR <= -500 The other would look something
like ::: >= -500 OR <= 500

How would I code for those scenarios in VB?

The VB I currently have is provided by a free script provided by Allen
Brown. He was kind enough offer some guidance, but is unable to assist me
all the way through.

'Net Cash Balance
If Not IsNull(Me.txtNetCashBal1) Then
strWhere = strWhere & " ([NET_CASH_BAL] >= " & Me.txtNetCashBal1 &
") AND "
End If

If Not IsNull(Me.txtNetCashBal2) Then
strWhere = strWhere & " ([NET_CASH_BAL] < " & txtNetCashBal2 + 1 &
") AND "
End If

Any assistance offered would be greatly appreciated!

Many Thanks,
-E
 
D

Dale Fye

How about using the absolute value function: ABS()

If not ISNULL(me.txtNetCashBal1) Then
strWhere = strWhere _
& " AND ABS([NET_CASH_BAL]) >= " & me.txtNetCashBal1
Endif

If not ISNULL(me.txtNetCashBal2) Then
strWhere = strWhere _
& " AND ABS([NET_CASH_BAL]) < " & me.txtNetCashBal2 + 1
Endif

HTH
Dale
 

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

Top