"Can't Reference a control's Property or Method Unless The Control Has the Focus

Dugantrain

I Love Pants
Local time
Today, 03:25
Joined
Mar 28, 2002
Messages
221
I have a subform datasheet that I will be having users copy and paste a large amount of information into. The problem is that under one of the fields, I have some code written:

Rec_Qty_AfterUpdate
if me.rec_qty.text=""
then me.rec_qty.value=0

This puts a zero into any Null values for the Rec_Qty field.

This works fine for manual entry as the user will focus into and out of the Rec_Qty field. However, when copying and pasting, the focus will not necessarily be on that field and I get the "Can't Reference..." error message. How can I get around this?
 
Just remove the property references:

if me.rec_qty="" then
me.rec_qty=0
 
Well, after having changed the code, I no longer get the error message, but now it won't put a 0 into the Null field; even when I focus into and out of the field manually.
 
Try this:


if isnull(me.rec_qty) then me.rec_qty=0
 
That nailed it, CPOD. God, this site has been my salvation on this, my first professional application. I just had to say it. I'd give you guys a great big smilie icon right now if I used the silly bastards.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom