What am I doing wrong??? I'm getting a headache!

G

Gina Whipp

Hello All,

I want to populate a txtPackaging with one value if true and another value
if false what I am getting is only the value as if the statement is always
true and I know for a fact that it is not.

Look at tblCustomerPricing if cpFlatRate =-1 and the second If statement is
true then show me the price or else show me nothing.

If (DLookup("cpFlateRate", "tblCustomerPricing", "cpCustomerID=" &
Forms![frmOrder]![cboCustomerID])) <> -1 Then
If Not IsNull([txtPackagingCodeID]) Or Not IsNull([txtLength]) Or
Not IsNull([txtCoilListWidth]) Or Not IsNull([txtWeight]) Then
Me.txtPackaging = TotExtras([txtPackagingCodeID], [txtLength],
[txtCoilListWidth], [txtWeight])
Else
Me.txtPackaging = ""
End If
End If


Thanks in advance!!!!
 
D

Douglas J Steele

What do you intend

If Not IsNull([txtPackagingCodeID]) Or Not IsNull([txtLength]) Or Not
IsNull([txtCoilListWidth]) Or Not IsNull([txtWeight]) Then

to tell you?

It's going to be true if at least one of the four text boxes isn't null,
which means that up to three of the text boxes can be null. Is that what you
wanted, or did you want all four of the text boxes to be non-null?

For the latter, you need to replace the Ors with Ands.
 
G

Gina Whipp

If cpFlatRate said:
If cpFlatRate <>-1 AND If Not IsNull([txtPackagingCodeID]) Or Not
IsNull([txtLength]) Or Not IsNull([txtCoilListWidth]) Or Not
IsNull([txtWeight]) Then >>> skip to Me.txtPackaging ="" which is not
what I intended.

Of course now that you pointed out (I missed that completely), I see the
error of my ways. But now I am stumped as to get the results I want. What
I want is... If cpFlatRate <>-1 skip to Me.txtPackaging = "" else do the
first part.

I guess I need to take two aspirin now.



Douglas J Steele said:
What do you intend

If Not IsNull([txtPackagingCodeID]) Or Not IsNull([txtLength]) Or Not
IsNull([txtCoilListWidth]) Or Not IsNull([txtWeight]) Then

to tell you?

It's going to be true if at least one of the four text boxes isn't null,
which means that up to three of the text boxes can be null. Is that what
you
wanted, or did you want all four of the text boxes to be non-null?

For the latter, you need to replace the Ors with Ands.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Gina Whipp said:
Hello All,

I want to populate a txtPackaging with one value if true and another
value
if false what I am getting is only the value as if the statement is
always
true and I know for a fact that it is not.

Look at tblCustomerPricing if cpFlatRate =-1 and the second If statement is
true then show me the price or else show me nothing.

If (DLookup("cpFlateRate", "tblCustomerPricing", "cpCustomerID=" &
Forms![frmOrder]![cboCustomerID])) <> -1 Then
If Not IsNull([txtPackagingCodeID]) Or Not IsNull([txtLength]) Or
Not IsNull([txtCoilListWidth]) Or Not IsNull([txtWeight]) Then
Me.txtPackaging = TotExtras([txtPackagingCodeID],
[txtLength],
[txtCoilListWidth], [txtWeight])
Else
Me.txtPackaging = ""
End If
End If


Thanks in advance!!!!
 
T

Tom Lake

Gina Whipp said:
Hello All,

I want to populate a txtPackaging with one value if true and another value
if false what I am getting is only the value as if the statement is always
true and I know for a fact that it is not.

Look at tblCustomerPricing if cpFlatRate =-1 and the second If statement
is true then show me the price or else show me nothing.

Would this work? (I don't know what you're trying to do with that TotExtras
line unless TotExtras is a 4-dimensional array!)

If (DLookup("cpFlateRate", "tblCustomerPricing", "cpCustomerID=" &
Forms![frmOrder]![cboCustomerID])) <> -1 Then
If Not IsNull([txtPackagingCodeID]) Or Not IsNull([txtLength]) Or Not
IsNull([txtCoilListWidth]) Or Not IsNull([txtWeight]) Then
Me.txtPackaging = TotExtras([txtPackagingCodeID], [txtLength],
[txtCoilListWidth], [txtWeight])
Else
Me.txtPackaging = ""
End If
Else
Me.txtPackaging = ""
End If

Tom Lake
 
D

Douglas J. Steele

You mean something like

If (DLookup("cpFlateRate", "tblCustomerPricing", _
"cpCustomerID=" & Forms![frmOrder]![cboCustomerID])) = -1 Then
If Not IsNull([txtPackagingCodeID]) And _
Not IsNull([txtLength]) And _
Not IsNull([txtCoilListWidth]) And _
Not IsNull([txtWeight]) Then
Me.txtPackaging = TotExtras( _
[txtPackagingCodeID], [txtLength], _
[txtCoilListWidth], [txtWeight])
Else
Me.txtPackaging = ""
End If
Else
Me.txtPackaging = ""
End If

?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Gina Whipp said:
If cpFlatRate <>-1 skip to Me.txtPackaging = "" But basically I am say
If cpFlatRate <>-1 AND If Not IsNull([txtPackagingCodeID]) Or Not
IsNull([txtLength]) Or Not IsNull([txtCoilListWidth]) Or Not
IsNull([txtWeight]) Then >>> skip to Me.txtPackaging ="" which is not
what I intended.

Of course now that you pointed out (I missed that completely), I see the
error of my ways. But now I am stumped as to get the results I want.
What I want is... If cpFlatRate <>-1 skip to Me.txtPackaging = "" else
do the first part.

I guess I need to take two aspirin now.



Douglas J Steele said:
What do you intend

If Not IsNull([txtPackagingCodeID]) Or Not IsNull([txtLength]) Or Not
IsNull([txtCoilListWidth]) Or Not IsNull([txtWeight]) Then

to tell you?

It's going to be true if at least one of the four text boxes isn't null,
which means that up to three of the text boxes can be null. Is that what
you
wanted, or did you want all four of the text boxes to be non-null?

For the latter, you need to replace the Ors with Ands.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Gina Whipp said:
Hello All,

I want to populate a txtPackaging with one value if true and another
value
if false what I am getting is only the value as if the statement is
always
true and I know for a fact that it is not.

Look at tblCustomerPricing if cpFlatRate =-1 and the second If
statement is
true then show me the price or else show me nothing.

If (DLookup("cpFlateRate", "tblCustomerPricing", "cpCustomerID=" &
Forms![frmOrder]![cboCustomerID])) <> -1 Then
If Not IsNull([txtPackagingCodeID]) Or Not IsNull([txtLength])
Or
Not IsNull([txtCoilListWidth]) Or Not IsNull([txtWeight]) Then
Me.txtPackaging = TotExtras([txtPackagingCodeID],
[txtLength],
[txtCoilListWidth], [txtWeight])
Else
Me.txtPackaging = ""
End If
End If


Thanks in advance!!!!
 
G

Guest

Gina,

Here is another way...
Look at tblCustomerPricing if cpFlatRate =-1 and the second If statement is
true then show me the price or else show me nothing.

Since the cpFlatRate has to be true and the second IF() 4 conditions have to
be true, it can be one IF() with 5 conditions.

' set txtPackaging to empty first
Me.txtPackaging = ""

If (DLookup("cpFlateRate", "tblCustomerPricing", _
"cpCustomerID=" & Forms![frmOrder]![cboCustomerID])) = -1 _
And Not IsNull([txtPackagingCodeID]) _
And Not IsNull([txtLength]) _
And Not IsNull([txtCoilListWidth]) _
And Not IsNull([txtWeight]) Then

Me.txtPackaging = TotExtras( _
[txtPackagingCodeID], [txtLength], _
[txtCoilListWidth], [txtWeight])

End If


HTH
 
G

Gina Whipp

Will try today.... thanks for the suggestions guys!!!


SteveS said:
Gina,

Here is another way...
Look at tblCustomerPricing if cpFlatRate =-1 and the second If statement
is
true then show me the price or else show me nothing.

Since the cpFlatRate has to be true and the second IF() 4 conditions have
to
be true, it can be one IF() with 5 conditions.

' set txtPackaging to empty first
Me.txtPackaging = ""

If (DLookup("cpFlateRate", "tblCustomerPricing", _
"cpCustomerID=" & Forms![frmOrder]![cboCustomerID])) = -1 _
And Not IsNull([txtPackagingCodeID]) _
And Not IsNull([txtLength]) _
And Not IsNull([txtCoilListWidth]) _
And Not IsNull([txtWeight]) Then

Me.txtPackaging = TotExtras( _
[txtPackagingCodeID], [txtLength], _
[txtCoilListWidth], [txtWeight])

End If


HTH
 
G

Gina Whipp

Heh Guys,

Thanks for your help but after reading your replies and then REthinking what
am I am doing. I put cpFlatRate in the WRONG table!!! Oh woe is me! Once
I move it to the correct table I can handle it.

If it had not been for you two I would have probably been STILL trying to do
it, what I now know is, the wrong way.


Gina Whipp said:
Will try today.... thanks for the suggestions guys!!!


SteveS said:
Gina,

Here is another way...
Look at tblCustomerPricing if cpFlatRate =-1 and the second If
statement is
true then show me the price or else show me nothing.

Since the cpFlatRate has to be true and the second IF() 4 conditions have
to
be true, it can be one IF() with 5 conditions.

' set txtPackaging to empty first
Me.txtPackaging = ""

If (DLookup("cpFlateRate", "tblCustomerPricing", _
"cpCustomerID=" & Forms![frmOrder]![cboCustomerID])) = -1 _
And Not IsNull([txtPackagingCodeID]) _
And Not IsNull([txtLength]) _
And Not IsNull([txtCoilListWidth]) _
And Not IsNull([txtWeight]) Then

Me.txtPackaging = TotExtras( _
[txtPackagingCodeID], [txtLength], _
[txtCoilListWidth], [txtWeight])

End If


HTH
 
G

Guest

Thanks for your help but after reading your replies and then REthinking what
am I am doing. I put cpFlatRate in the WRONG table!!! Oh woe is me! Once
I move it to the correct table I can handle it.

You're welcome.

I confess I *was* wondering why you were doing a calculation (LxWxH) if
cpFlatRate was true.....but I thought I wasn't understanding what you
wanted.... :)
 

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