Is this the correct Syntax?

fluid

Registered User.
Local time
Today, 15:13
Joined
Nov 27, 2008
Messages
81
I'm trying to make a variable(QTYA) equal to an integer value in a textbox. The textbox is on the subform.

To me, it looks correct. But it's not working...It keeps equalling 0 regardless of what the textbox value is.


QTYA = Me!RFP_subform.Form![QTYRECTOTAL]
 
The key with subforms is to use the name of the subform control (control on the parent form which houses/displays the subform itself) and not the name of the subform UNLESS they are both named exactly the same. So, if your subform control is named RFP_subform (with the underscore) then what you have should work. I prefer using dot notation over bangs for intellisense so it would be:

QTYA = Me.RFP_subform.Form.QTYRECTOTAL

or if the name actually has spaces

QTYA = Me("RFP subform").Form.QTYRECTOTAL
 
Is it okay to have the subform control and the subform named the same?

The name of my subform is RFP_Subform, and so is the control.

When i use a Breakpoint to hover over the code, view the values after that line of code has been run, I get

QTYA=0
Me.RFP_subform.Form.QTYRECTOTAL = 5

Shouldn't they be the same given the above coding? what would make that equation not work?
 
You have to go PAST that line by using F8 before it gets assigned the value. If you've set the breakpoint on that line, it won't be set yet.
 
I'm really stuck here, It seems like such a simple task. I don't know what I've done wrong.

Any help?
 
I'm probably going to embarass myself because I'm a COMPLETE novice with VBA... and I'm not even sure if what I'm posting will make any sense!

I'm wondering if your data types are messing things up at all?
You mentioned a text box, is the data type an integer or text?
:confused:
 

Users who are viewing this thread

Back
Top Bottom