looping controls has no value

spinkung

Registered User.
Local time
Today, 04:13
Joined
Dec 4, 2006
Messages
267
ahhhhghghhgghhh


why oh why is access messing with me.

i have this
Code:
            If Left(ctl.Name, 11) = "txt_SafeHaz" Then
            MsgBox ctl.Value
            MsgBox Me.txt_SafeHaz01.Value

basically i wat to loop through my controls. when i get to some with a prefix of called txt_SafeHaz... i want to put the value in an array.

so when i do msgbox ctl.value it comes out BLANK. NOT with a value.
when i do MsgBox Me.txt_SafeHaz01.Value it shows the value.

am i going mad or should this work.
 
worked perfectly. thankyou.
 
There must be something wrong with your loop.
Code:
Dim ctrl as Control
   For Each ctrl In Me
      If Left(ctrl.Name, 11) = whatever
         DoSomething
      End If
   Next

BTW Value is the default property so does not need to be explicit.
 

Users who are viewing this thread

Back
Top Bottom