A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Error 438



 
 
Thread Tools Display Modes
  #1  
Old February 15th, 2009, 02:11 PM posted to microsoft.public.access.gettingstarted
Ray C
external usenet poster
 
Posts: 215
Default Error 438

I have a routine that I use to set various parameters of certain controls on
my form and I manage which control by assigning each control a "Tag" name as
follows :-

Public Sub util_FormSetup(frm As Form, Opps As String, Stat As Boolean, all
As Integer)

Dim cntrl As Control
On Error GoTo Err_Util_FormSetup

For Each cntrl In frm
Debug.Print cntrl.Name; " "; cntrl; " "; cntrl.Tag
Select Case all
Case 0 ' Apply "Stat" to every Control on
the Form
cntrl.Properties(Opps) = Stat
Case 1 '
Apply "Stat" only to a Control
If cntrl.Tag = "Lock" Then cntrl.Properties(Opps) = Stat
'where Tag = "Lock"

Case 2 '
Apply "Stat" only to a Control
If cntrl.Tag = "Find" Then cntrl.Properties(Opps) = Stat
'where Tag = "Find"
End Select
Next cntrl

Exit_Util_FormSetup:
Exit Sub

With the appropriate parameters being passed to the routine. "Form" = the
Form Name, "Opps" = the operation Visible / Locked etc, "Stat" = True / False
and "all" is a numeric value that picks out which group of controls I want to
work on i.e 0 = All the Controls on the Form, 1 = only the controls with
"Tag" set to "Lock" etc

My logic being that the operation would only be actioned on a control where
the appropiate Tag was set. If a control had it's Tag set to nothing or set
to anything other than what was required then the operation should then skip
past it and not effect any change.

Howeve, wenever I use this routine to "Lock" or "Unlock" a control for
editing, the routine seems to run through a few controls OK and the produces
an Error Number 438 "object does not support this property or method". I have
a sneaky feeling that this could be something to do with the labels that are
on the form but if their Tag is Blank the routine should just ignore the
label and move on to the next control.

This routine used to work fine until recently and whilst I appreciate that I
must have done something to affect the change, I do not know what that might
be and therefore I can not put it right.

Any help appreciated Thanks ray C

  #2  
Old February 15th, 2009, 02:24 PM posted to microsoft.public.access.gettingstarted
RoyVidar
external usenet poster
 
Posts: 417
Default Error 438

Ray C wrote:
I have a routine that I use to set various parameters of certain
controls on my form and I manage which control by assigning each
control a "Tag" name as follows :-

Public Sub util_FormSetup(frm As Form, Opps As String, Stat As
Boolean, all As Integer)

Dim cntrl As Control
On Error GoTo Err_Util_FormSetup

For Each cntrl In frm
Debug.Print cntrl.Name; " "; cntrl; " "; cntrl.Tag
Select Case all
Case 0 ' Apply "Stat" to every
Control on the Form
cntrl.Properties(Opps) = Stat
Case 1
' Apply "Stat" only to a Control
If cntrl.Tag = "Lock" Then cntrl.Properties(Opps) =
Stat 'where Tag = "Lock"

Case 2
' Apply "Stat" only to a Control
If cntrl.Tag = "Find" Then cntrl.Properties(Opps) =
Stat 'where Tag = "Find"
End Select
Next cntrl

Exit_Util_FormSetup:
Exit Sub

With the appropriate parameters being passed to the routine. "Form" =
the Form Name, "Opps" = the operation Visible / Locked etc, "Stat" =
True / False and "all" is a numeric value that picks out which group
of controls I want to work on i.e 0 = All the Controls on the Form,
1 = only the controls with "Tag" set to "Lock" etc

My logic being that the operation would only be actioned on a control
where the appropiate Tag was set. If a control had it's Tag set to
nothing or set to anything other than what was required then the
operation should then skip past it and not effect any change.

Howeve, wenever I use this routine to "Lock" or "Unlock" a control
for editing, the routine seems to run through a few controls OK and
the produces an Error Number 438 "object does not support this
property or method". I have a sneaky feeling that this could be
something to do with the labels that are on the form but if their
Tag is Blank the routine should just ignore the label and move on to
the next control.

This routine used to work fine until recently and whilst I appreciate
that I must have done something to affect the change, I do not know
what that might be and therefore I can not put it right.

Any help appreciated Thanks ray C


I see you have a debug print before entering the loop, that means you
know which control it barfs on.

Let's say you're looping all controls, then consider that labels,
command buttons, and perhaps some other control types, does not
have a locked property.

You might want to do some check what kind of control it is, which
you can do for instance through tests of the following kind

Select Case cntrl.ControlType
Case acComboBox, acListBox, acTextBox, ...

where you can exclude certain types of controls prior to altering
certain properties.

--
Roy-Vidar


  #3  
Old February 15th, 2009, 07:45 PM posted to microsoft.public.access.gettingstarted
Ray C
external usenet poster
 
Posts: 215
Default Error 438

Hi Roy, thank you for your input. whilst it did not solve my problem it makes
the whole routine much better to filter out the controls that I am not
interested in and I did not know how to do that before.

It seems that the offending issue was the line
Debug.Print cntrl.Name; '" "; cntrl; " "; cntrl.Tag
Where it would print the required info until it is asked to print a "Tab"
that I have in my Form and that is what was cusing the error message.

thanks for you kind help anyway

regards RayC

"RoyVidar" wrote:

Ray C wrote:
I have a routine that I use to set various parameters of certain
controls on my form and I manage which control by assigning each
control a "Tag" name as follows :-

Public Sub util_FormSetup(frm As Form, Opps As String, Stat As
Boolean, all As Integer)

Dim cntrl As Control
On Error GoTo Err_Util_FormSetup

For Each cntrl In frm
Debug.Print cntrl.Name; " "; cntrl; " "; cntrl.Tag
Select Case all
Case 0 ' Apply "Stat" to every
Control on the Form
cntrl.Properties(Opps) = Stat
Case 1
' Apply "Stat" only to a Control
If cntrl.Tag = "Lock" Then cntrl.Properties(Opps) =
Stat 'where Tag = "Lock"

Case 2
' Apply "Stat" only to a Control
If cntrl.Tag = "Find" Then cntrl.Properties(Opps) =
Stat 'where Tag = "Find"
End Select
Next cntrl

Exit_Util_FormSetup:
Exit Sub

With the appropriate parameters being passed to the routine. "Form" =
the Form Name, "Opps" = the operation Visible / Locked etc, "Stat" =
True / False and "all" is a numeric value that picks out which group
of controls I want to work on i.e 0 = All the Controls on the Form,
1 = only the controls with "Tag" set to "Lock" etc

My logic being that the operation would only be actioned on a control
where the appropiate Tag was set. If a control had it's Tag set to
nothing or set to anything other than what was required then the
operation should then skip past it and not effect any change.

Howeve, wenever I use this routine to "Lock" or "Unlock" a control
for editing, the routine seems to run through a few controls OK and
the produces an Error Number 438 "object does not support this
property or method". I have a sneaky feeling that this could be
something to do with the labels that are on the form but if their
Tag is Blank the routine should just ignore the label and move on to
the next control.

This routine used to work fine until recently and whilst I appreciate
that I must have done something to affect the change, I do not know
what that might be and therefore I can not put it right.

Any help appreciated Thanks ray C


I see you have a debug print before entering the loop, that means you
know which control it barfs on.

Let's say you're looping all controls, then consider that labels,
command buttons, and perhaps some other control types, does not
have a locked property.

You might want to do some check what kind of control it is, which
you can do for instance through tests of the following kind

Select Case cntrl.ControlType
Case acComboBox, acListBox, acTextBox, ...

where you can exclude certain types of controls prior to altering
certain properties.

--
Roy-Vidar



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.