Access setting varible to null when it has a value

FrostByte

Registered User.
Local time
Today, 08:59
Joined
Jan 15, 2015
Messages
56
Hi,

I am confused...
I have the following simple variable assignment...


Dim PolRef As String
Let PolRef = Me.Policy_Ref_Num

But when I run my code I get "Invalid Use of Null" and PolRef is set to ""

This field is populated however, so I'm confused to why I cant set my variable to it.

If I don't use a variable and simply have let XXX = me.Me.Policy_Ref_Num then it still wont return the value from the field.

Thanks in advance.
 
Have you tried:
Dim PolRef As String
PolRef = Me.Policy_Ref_Num

Is the code in the forms code module?
Is Policy_Ref_Num the name of a control on the form?
 
Have you tried:
Dim PolRef As String
PolRef = Me.Policy_Ref_Num

Is the code in the forms code module?
Is Policy_Ref_Num the name of a control on the form?

Hi Bob,

Its part of an e-mail button on the form that works fine apart from not returning this one field. It returns other fields of the same type.

I've tried dropping the "Let" from your suggestion but still not working.
Its also definitely the control name of the field. I've copied it directly from the properties into my code.
 
Is Policy_Ref_Num the controls Name or Record Source?
 
Is Policy_Ref_Num the controls Name or Record Source?

Bob your a genius!

The name was called Text117 the record Source was Policy_Ref_Num. My bad programming but all works fine now.

Im not great as this VBA I just muddle through.

Massive appreciation.
Frost
 
Bob your a genius!

The name was called Text117 the record Source was Policy_Ref_Num. My bad programming but all works fine now.

Im not great as this VBA I just muddle through.

Massive appreciation.
Frost
Glad you got it sorted. Perhaps you would mark the thread as solved.
 

Users who are viewing this thread

Back
Top Bottom