why doesnt this work????

  • Thread starter Thread starter Paul Foster
  • Start date Start date
P

Paul Foster

Can anyone please explain to me why this statement doesnt
work:

Private Sub Form_Current()
Dim varihigh
varihigh = CInt(225 * Me!frmRMsubform![txtROWCOUNT])
End Sub

From the immediate window i get that
Me!frmRMsubform![txtROWCOUNT]) = 4
CInt(225 * Me!frmRMsubform![txtROWCOUNT]) = 900
varihigh = 0 ( in the locals window it says its empty)

I dont understand. Could somebody please explain.

Thanks in advance
Paul Foster
Bournemouth UK
pfos.uk NOSPAMPLEASE @ ntlworld . com
 
Paul,
At first glance, it looks like you have not declared your
varihigh variable properly. It should be something like
Dim varihigh As ... (what ever it is, Integer, text etc.)

HTH

Paul
 
If you don't declare a specific data type in the Dim, variant is the
default, so this likely isn't the problem.

I suggest that you verify that you have no typos (I don't see any in this
code, but just doublecheck).

Is varihigh declared elsewhere in the module or in the database as a global
variable? If yes, putting it in a Dim statement in a procedure can cause
problems with the value that is being saved.

Otherwise, put a breakpoint on the offending line of code, and when it
stops, put your cursor over the Me!frmRMsubform![txtROWCOUNT] in the code to
verify that Me!frmRMsubform![txtROWCOUNT] is actually the value you think it
should be when the code step is executed. Then, press F8 and see what the
value of varihigh is by putting cursor over it.

--
Ken Snell
<MS ACCESS MVP>

Paul Falla said:
Paul,
At first glance, it looks like you have not declared your
varihigh variable properly. It should be something like
Dim varihigh As ... (what ever it is, Integer, text etc.)

HTH

Paul
-----Original Message-----
Can anyone please explain to me why this statement doesnt
work:

Private Sub Form_Current()
Dim varihigh
varihigh = CInt(225 * Me!frmRMsubform![txtROWCOUNT])
End Sub

From the immediate window i get that
Me!frmRMsubform![txtROWCOUNT]) = 4
CInt(225 * Me!frmRMsubform![txtROWCOUNT]) = 900
varihigh = 0 ( in the locals window it says its empty)

I dont understand. Could somebody please explain.

Thanks in advance
Paul Foster
Bournemouth UK
pfos.uk NOSPAMPLEASE @ ntlworld . com
.
 
Thanks for responding.

Ive tried the statement using Dim ... as Integer, Ive
also tried without the CInt().

The variable isnt declared anywhere else. Using a
breakpoint at End Sub, doing as you suggest, all the
values are as I said in my original email. I dont
understand how an expression to the right of an
assignment operator can have a value, but not passed to
the variable to the left hand side. Im sure its
something simple that I'm missing, but I can't see what
the problem is.

Youve probably guessed this is only a part of the code.
There are no problems elsewhere.

Paul Foster
Bournemouth UK
pfos.uk NOSPAMPLEASE @ ntlworld . com
-----Original Message-----
If you don't declare a specific data type in the Dim, variant is the
default, so this likely isn't the problem.

I suggest that you verify that you have no typos (I don't see any in this
code, but just doublecheck).

Is varihigh declared elsewhere in the module or in the database as a global
variable? If yes, putting it in a Dim statement in a procedure can cause
problems with the value that is being saved.

Otherwise, put a breakpoint on the offending line of code, and when it
stops, put your cursor over the Me!frmRMsubform! [txtROWCOUNT] in the code to
verify that Me!frmRMsubform![txtROWCOUNT] is actually the value you think it
should be when the code step is executed. Then, press F8 and see what the
value of varihigh is by putting cursor over it.

--
Ken Snell
<MS ACCESS MVP>

Paul Falla said:
Paul,
At first glance, it looks like you have not declared your
varihigh variable properly. It should be something like
Dim varihigh As ... (what ever it is, Integer, text etc.)

HTH

Paul
-----Original Message-----
Can anyone please explain to me why this statement doesnt
work:

Private Sub Form_Current()
Dim varihigh
varihigh = CInt(225 * Me!frmRMsubform![txtROWCOUNT])
End Sub

From the immediate window i get that
Me!frmRMsubform![txtROWCOUNT]) = 4
CInt(225 * Me!frmRMsubform![txtROWCOUNT]) = 900
varihigh = 0 ( in the locals window it says its empty)

I dont understand. Could somebody please explain.

Thanks in advance
Paul Foster
Bournemouth UK
pfos.uk NOSPAMPLEASE @ ntlworld . com
.


.
 
I don't see anything obvious in the code snippet that you've posted. I
assume there is more going on in the code than just this.

If you can zip up the database (< 1 MB) and email it to me ( remove this is
not real from my email address), I'll take a look. Be sure to give enough
instructions so that I can reproduce what you're doing.

--
Ken Snell
<MS ACCESS MVP>

Paul Foster said:
Thanks for responding.

Ive tried the statement using Dim ... as Integer, Ive
also tried without the CInt().

The variable isnt declared anywhere else. Using a
breakpoint at End Sub, doing as you suggest, all the
values are as I said in my original email. I dont
understand how an expression to the right of an
assignment operator can have a value, but not passed to
the variable to the left hand side. Im sure its
something simple that I'm missing, but I can't see what
the problem is.

Youve probably guessed this is only a part of the code.
There are no problems elsewhere.

Paul Foster
Bournemouth UK
pfos.uk NOSPAMPLEASE @ ntlworld . com
-----Original Message-----
If you don't declare a specific data type in the Dim, variant is the
default, so this likely isn't the problem.

I suggest that you verify that you have no typos (I don't see any in this
code, but just doublecheck).

Is varihigh declared elsewhere in the module or in the database as a global
variable? If yes, putting it in a Dim statement in a procedure can cause
problems with the value that is being saved.

Otherwise, put a breakpoint on the offending line of code, and when it
stops, put your cursor over the Me!frmRMsubform! [txtROWCOUNT] in the code to
verify that Me!frmRMsubform![txtROWCOUNT] is actually the value you think it
should be when the code step is executed. Then, press F8 and see what the
value of varihigh is by putting cursor over it.

--
Ken Snell
<MS ACCESS MVP>

Paul Falla said:
Paul,
At first glance, it looks like you have not declared your
varihigh variable properly. It should be something like
Dim varihigh As ... (what ever it is, Integer, text etc.)

HTH

Paul
-----Original Message-----
Can anyone please explain to me why this statement doesnt
work:

Private Sub Form_Current()
Dim varihigh
varihigh = CInt(225 * Me!frmRMsubform![txtROWCOUNT])
End Sub

From the immediate window i get that
Me!frmRMsubform![txtROWCOUNT]) = 4
CInt(225 * Me!frmRMsubform![txtROWCOUNT]) = 900
varihigh = 0 ( in the locals window it says its empty)

I dont understand. Could somebody please explain.

Thanks in advance
Paul Foster
Bournemouth UK
pfos.uk NOSPAMPLEASE @ ntlworld . com
.


.
 
Is this code written in the main form or is it part of Form Current of the
subform? If the former wouldn't you need to specify the main form name in
the code with the subform name? If Form_Current references subform form,
then off hand I don't see anything glaring wrong.

Paul Foster said:
Thanks for responding.

Ive tried the statement using Dim ... as Integer, Ive
also tried without the CInt().

The variable isnt declared anywhere else. Using a
breakpoint at End Sub, doing as you suggest, all the
values are as I said in my original email. I dont
understand how an expression to the right of an
assignment operator can have a value, but not passed to
the variable to the left hand side. Im sure its
something simple that I'm missing, but I can't see what
the problem is.

Youve probably guessed this is only a part of the code.
There are no problems elsewhere.

Paul Foster
Bournemouth UK
pfos.uk NOSPAMPLEASE @ ntlworld . com
-----Original Message-----
If you don't declare a specific data type in the Dim, variant is the
default, so this likely isn't the problem.

I suggest that you verify that you have no typos (I don't see any in this
code, but just doublecheck).

Is varihigh declared elsewhere in the module or in the database as a global
variable? If yes, putting it in a Dim statement in a procedure can cause
problems with the value that is being saved.

Otherwise, put a breakpoint on the offending line of code, and when it
stops, put your cursor over the Me!frmRMsubform! [txtROWCOUNT] in the code to
verify that Me!frmRMsubform![txtROWCOUNT] is actually the value you think it
should be when the code step is executed. Then, press F8 and see what the
value of varihigh is by putting cursor over it.

--
Ken Snell
<MS ACCESS MVP>

Paul Falla said:
Paul,
At first glance, it looks like you have not declared your
varihigh variable properly. It should be something like
Dim varihigh As ... (what ever it is, Integer, text etc.)

HTH

Paul
-----Original Message-----
Can anyone please explain to me why this statement doesnt
work:

Private Sub Form_Current()
Dim varihigh
varihigh = CInt(225 * Me!frmRMsubform![txtROWCOUNT])
End Sub

From the immediate window i get that
Me!frmRMsubform![txtROWCOUNT]) = 4
CInt(225 * Me!frmRMsubform![txtROWCOUNT]) = 900
varihigh = 0 ( in the locals window it says its empty)

I dont understand. Could somebody please explain.

Thanks in advance
Paul Foster
Bournemouth UK
pfos.uk NOSPAMPLEASE @ ntlworld . com
.


.
 
Back
Top