Formula help.

QuietRiot

Registered User.
Local time
Today, 05:00
Joined
Oct 13, 2007
Messages
71
Code:
if isnull({AccountReps.DealerNumber})= true then
{AccountInfo.TrustDealerNumber} else {AccountReps.DealerNumber}

This is what i currently have. I also want to add that if both {AccountReps.DealerNumber} and {AccountInfo.TrustDealerNumber} are null then use {AccountInfo.AccountNumber}


any help.. thanks
 
Almost there ...

Code:
If IsNull(something) And IsNull(something) Then
    'do this
ElseIf 'something
    'do the other
Else
    'do the last
End If

-dK
 
Thanks!! I guess it's just like VB/VBA.
 
So close you almost can't taste the difference!

-dK
 
still having issues..

Code:
if isnull({AccountReps.DealerNumber})= true and isnull({AccountInfo.TrustDealerNumber})=true then
{AccountInfo.AccountNumber}
else if isnull({AccountReps.DealerNumber})= true and isnull({AccountInfo.TrustDealerNumber})= false then
{AccountInfo.TrustDealerNumber}
else {AccountReps.DealerNumber}

its saying a string is required @ Else if
 
You are using the evaluation: isnull({AccountReps.DealerNumber})= true

I am short on terminology but the IsNull function evaluates by returning a TRUE if the field is null (and false if not). You do not need to equate it. The opposite is "If Not IsNull(...) Then ... "

Also, you have "else if" with a space, it should be "ElseIf" with no space.

Code:
If IsNull({AccountReps.DealerNumber}) And IsNull({AccountInfo.TrustDealerNumber}) Then 'do something if both fields are null (true)
    {AccountInfo.AccountNumber} 
ElseIf IsNull({AccountReps.DealerNumber}) And IsNull({AccountInfo.TrustDealerNumber}) Then
    {AccountInfo.TrustDealerNumber} 
Else {AccountReps.DealerNumber}
End If

Last note: You are using "({AccountReps.DealerNumber})" to designate a field of some sort.

If this is code on a form then you need to reference the control that has the field bound to it. For instance, Me.txtDealerNumber would reference a control with the name "txtDealerNumber". txtDealerNumber would then need to be bound to the field "DealerNumber".

-dK
 
Last edited:
You betcha. Welcome to VBA, btw.

-dK
 

Users who are viewing this thread

Back
Top Bottom