Assinging a value to a txtBox

A

Anthony Viscomi

I have a txtBox on a form and I want to display the Total$ Due. The actual
value reside within another tbl (Transactions). I have the following:

iTempDue = DSum("[WithdrawalAmount]", "[Transactions]", "[SS] = '" & Me!SS &
"'")
iTempPD = DSum("[DepositAmount]", "[Transactions]", "[SS] = '" & Me!SS &
"'")
TotalDueX = IIf(IsNull(iTempDue), 0, iTempDue)
TotalPDX = IIf(IsNull(iTempPD), 0, iTempPD)

Me.txtOutstanding = TotalDueX - TotalPDX

The code "dies" on the assigning of the value to txtOutstanding.

Any thoughts?
Thanks!
Anthony
 
A

Andi Mayer

I have a txtBox on a form and I want to display the Total$ Due. The actual
value reside within another tbl (Transactions). I have the following:

iTempDue = DSum("[WithdrawalAmount]", "[Transactions]", "[SS] = '" & Me!SS &
"'")
iTempPD = DSum("[DepositAmount]", "[Transactions]", "[SS] = '" & Me!SS &
"'")
TotalDueX = IIf(IsNull(iTempDue), 0, iTempDue)
TotalPDX = IIf(IsNull(iTempPD), 0, iTempPD)

Me.txtOutstanding = TotalDueX - TotalPDX

The code "dies" on the assigning of the value to txtOutstanding.

Any thoughts?
Thanks!
Anthony
whats the error message and whats the type of the variables and
control
 
A

Anthony Viscomi

The Variables are:
Dim TotalDueX As Currency
Dim TotalPDX As Currency
Dim iTempDue As Variant
Dim iTempPD As Variant

The error msg is: "You can not assign a value to this object"

the control is set to currency
Andi Mayer said:
I have a txtBox on a form and I want to display the Total$ Due. The actual
value reside within another tbl (Transactions). I have the following:

iTempDue = DSum("[WithdrawalAmount]", "[Transactions]", "[SS] = '" & Me!SS
&
"'")
iTempPD = DSum("[DepositAmount]", "[Transactions]", "[SS] = '" & Me!SS &
"'")
TotalDueX = IIf(IsNull(iTempDue), 0, iTempDue)
TotalPDX = IIf(IsNull(iTempPD), 0, iTempPD)

Me.txtOutstanding = TotalDueX - TotalPDX

The code "dies" on the assigning of the value to txtOutstanding.

Any thoughts?
Thanks!
Anthony
whats the error message and whats the type of the variables and
control
 
A

Andi Mayer

The Variables are:
Dim TotalDueX As Currency
Dim TotalPDX As Currency
Dim iTempDue As Variant
Dim iTempPD As Variant

The error msg is: "You can not assign a value to this object"

the control is set to currency

and the control has a controlsource
the error is telling you that you can't change the value of this
control, because this controlsource doesn't have a value

BTW: why you don't use the nz-function?
TotalPDX=Nz(Sum..... ,0)
Andi Mayer said:
I have a txtBox on a form and I want to display the Total$ Due. The actual
value reside within another tbl (Transactions). I have the following:

iTempDue = DSum("[WithdrawalAmount]", "[Transactions]", "[SS] = '" & Me!SS
&
"'")
iTempPD = DSum("[DepositAmount]", "[Transactions]", "[SS] = '" & Me!SS &
"'")
TotalDueX = IIf(IsNull(iTempDue), 0, iTempDue)
TotalPDX = IIf(IsNull(iTempPD), 0, iTempPD)

Me.txtOutstanding = TotalDueX - TotalPDX

The code "dies" on the assigning of the value to txtOutstanding.

Any thoughts?
Thanks!
Anthony
whats the error message and whats the type of the variables and
control
 
A

Anthony Viscomi

You're right! I was trying to create an expression within that txtBox and I
forgot to delete it. Thanks!

I didn't use the Nz function for the IIf(IsNull(iTempPD), 0, iTempPD)
because I had this code within another module and I just copied and pasted
it into the current. It does perform the same as TotalPDX=Nz(Sum..... ,0)
doesn't it?
Andi Mayer said:
The Variables are:
Dim TotalDueX As Currency
Dim TotalPDX As Currency
Dim iTempDue As Variant
Dim iTempPD As Variant

The error msg is: "You can not assign a value to this object"

the control is set to currency

and the control has a controlsource
the error is telling you that you can't change the value of this
control, because this controlsource doesn't have a value

BTW: why you don't use the nz-function?
TotalPDX=Nz(Sum..... ,0)
Andi Mayer said:
On Mon, 24 Jan 2005 10:18:21 -0500, "Anthony Viscomi"

I have a txtBox on a form and I want to display the Total$ Due. The
actual
value reside within another tbl (Transactions). I have the following:

iTempDue = DSum("[WithdrawalAmount]", "[Transactions]", "[SS] = '" &
Me!SS
&
"'")
iTempPD = DSum("[DepositAmount]", "[Transactions]", "[SS] = '" & Me!SS &
"'")
TotalDueX = IIf(IsNull(iTempDue), 0, iTempDue)
TotalPDX = IIf(IsNull(iTempPD), 0, iTempPD)

Me.txtOutstanding = TotalDueX - TotalPDX

The code "dies" on the assigning of the value to txtOutstanding.

Any thoughts?
Thanks!
Anthony

whats the error message and whats the type of the variables and
control
---
If you expect an answer to a personal mail, add the word "manfred" to
the
first 10 lines in the message
MW
 
A

Andi Mayer

You're right! I was trying to create an expression within that txtBox and I
forgot to delete it. Thanks!

I didn't use the Nz function for the IIf(IsNull(iTempPD), 0, iTempPD)
because I had this code within another module and I just copied and pasted
it into the current. It does perform the same as TotalPDX=Nz(Sum..... ,0)
doesn't it?

it is the same result, but it spares two variables and 4 lines

a oneLiner:

Me.txtOutstanding
=DSum("NZ([WithdrawalAmount],0)-nz([DepositAmount],0",
"[Transactions]", "[SS] = '" & Me!SS &"'")

this can give a different result, because it's calculated if one of
the fields is Null
Andi Mayer said:
The Variables are:
Dim TotalDueX As Currency
Dim TotalPDX As Currency
Dim iTempDue As Variant
Dim iTempPD As Variant

The error msg is: "You can not assign a value to this object"

the control is set to currency

and the control has a controlsource
the error is telling you that you can't change the value of this
control, because this controlsource doesn't have a value

BTW: why you don't use the nz-function?
TotalPDX=Nz(Sum..... ,0)
On Mon, 24 Jan 2005 10:18:21 -0500, "Anthony Viscomi"

I have a txtBox on a form and I want to display the Total$ Due. The
actual
value reside within another tbl (Transactions). I have the following:

iTempDue = DSum("[WithdrawalAmount]", "[Transactions]", "[SS] = '" &
Me!SS
&
"'")
iTempPD = DSum("[DepositAmount]", "[Transactions]", "[SS] = '" & Me!SS &
"'")
TotalDueX = IIf(IsNull(iTempDue), 0, iTempDue)
TotalPDX = IIf(IsNull(iTempPD), 0, iTempPD)

Me.txtOutstanding = TotalDueX - TotalPDX

The code "dies" on the assigning of the value to txtOutstanding.

Any thoughts?
Thanks!
Anthony

whats the error message and whats the type of the variables and
control
---
If you expect an answer to a personal mail, add the word "manfred" to
the
first 10 lines in the message
MW
 
A

Anthony Viscomi

Thanks for everything!
Andi Mayer said:
You're right! I was trying to create an expression within that txtBox and
I
forgot to delete it. Thanks!

I didn't use the Nz function for the IIf(IsNull(iTempPD), 0, iTempPD)
because I had this code within another module and I just copied and pasted
it into the current. It does perform the same as TotalPDX=Nz(Sum..... ,0)
doesn't it?

it is the same result, but it spares two variables and 4 lines

a oneLiner:

Me.txtOutstanding
=DSum("NZ([WithdrawalAmount],0)-nz([DepositAmount],0",
"[Transactions]", "[SS] = '" & Me!SS &"'")

this can give a different result, because it's calculated if one of
the fields is Null
Andi Mayer said:
On Mon, 24 Jan 2005 10:48:21 -0500, "Anthony Viscomi"

The Variables are:
Dim TotalDueX As Currency
Dim TotalPDX As Currency
Dim iTempDue As Variant
Dim iTempPD As Variant

The error msg is: "You can not assign a value to this object"

the control is set to currency

and the control has a controlsource
the error is telling you that you can't change the value of this
control, because this controlsource doesn't have a value

BTW: why you don't use the nz-function?
TotalPDX=Nz(Sum..... ,0)

On Mon, 24 Jan 2005 10:18:21 -0500, "Anthony Viscomi"

I have a txtBox on a form and I want to display the Total$ Due. The
actual
value reside within another tbl (Transactions). I have the following:

iTempDue = DSum("[WithdrawalAmount]", "[Transactions]", "[SS] = '" &
Me!SS
&
"'")
iTempPD = DSum("[DepositAmount]", "[Transactions]", "[SS] = '" & Me!SS
&
"'")
TotalDueX = IIf(IsNull(iTempDue), 0, iTempDue)
TotalPDX = IIf(IsNull(iTempPD), 0, iTempPD)

Me.txtOutstanding = TotalDueX - TotalPDX

The code "dies" on the assigning of the value to txtOutstanding.

Any thoughts?
Thanks!
Anthony

whats the error message and whats the type of the variables and
control
---
If you expect an answer to a personal mail, add the word "manfred" to
the
first 10 lines in the message
MW


---
If you expect an answer to a personal mail, add the word "manfred" to
the
first 10 lines in the message
MW
 

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