auto_logo() (1 Viewer)

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
I am trying to disable the controls on a form and keep coming up against "Auto_logo()"
1) what is it?
2) how can I bypass it?

My code below

Code:
Public Function lockAll()
    Dim frm As Form
    Dim ctl As control
    If UserLevel = 3 Then    '  "userlevel" is set in a login form
        Set frm = Screen.ActiveForm
        For Each ctl In frm.Controls
            If InStr(ctl.Name, "btn") = 0 Then
                ctl.Locked = True    '  stops students from altering data
            End If
        Next ctl
    End If
End Function
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:23
Joined
May 7, 2009
Messages
19,245
"Auto_logo()" i think, access create the name for the Label control.
you cannot Locked a Label control. Only Controls that receives focus.
 

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
"Auto_logo()" i think, access create the name for the Label control.
you cannot Locked a Label control. Only Controls that receives focus.
Trouble is, it throws an error. I know I can use "on error resume next": but I think that's a bit of a cop out.
It lets the program progress but doesn't really solve anything.
The error seems to be that "ctl.Name" is not supported by "auto_logo()" which is obviously a function of some kind.
An internet search has 0 results.
 

June7

AWF VIP
Local time
Today, 14:23
Joined
Mar 9, 2014
Messages
5,474
What do you mean by "coming up against"? What happens - error message, wrong result, nothing? I am not aware of an intrinsic Auto_logo() function. Possibly a VBA UDF. Search VBA modules for that string.

If you want to disable buttons, shouldn't it be:

InStr(ctl.Name, "btn") > 0

If you want to disable data entry controls (textbox, combobox, listbox, etc) then check for type of control or use Tag property.

For textboxes and comboboxes, consider Conditional Formatting to enable/disable.

How is your function called? Could be a Sub instead because no value is returned by your function.
 
Last edited:

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
If you want to disable buttons, shouldn't it be:

InStr(ctl.Name, "btn") > 0

If you want to disable data entry controls (textbox, combobox, listbox, etc) then check for type of control or use Tag property.

For textboxes and comboboxes, consider Conditional Formatting.

I am not aware of an intrinsic Auto_logo() function. Possibly a VBA UDF. Search VBA modules for that string.
No, I want the buttons to be enabled while text and combo boxes are disabled.
I do use tags for some of my controls but this is, should be, easier to lock all controls on a form.
If you go to design view on some forms and scroll to the top of the list you will see "Auto_Logo()"
Not all forms have the "Auto_Logo()" function included. I am currently trying to work out the criteria and will post again when I know the answer.
 

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
I can't figure this.
It seems larger forms have the "Auto_Logo" function while smaller forms don't.
I have systematically removed all items from the detail and header sections and the function stays until I switch off the header / footers.
Switching them back on does not return the function in question.
On error resume next gets around the problem but I would appreciate a better solution.
 

Attachments

  • Database1.accdb
    640 KB · Views: 76

June7

AWF VIP
Local time
Today, 14:23
Joined
Mar 9, 2014
Messages
5,474
Top of what list? I cannot find this on any of my forms. I have never noticed this in any database.

Edit: I am looking at your db now.
 

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
Sorry.
Because I know what I'm talking about, you are expected to know also!
Have a look at the attached screenshot.
Screenshot_16.jpg
 

June7

AWF VIP
Local time
Today, 14:23
Joined
Mar 9, 2014
Messages
5,474
Okay, got it now. It is not a function, it is an image control behind the No Accession Number button. Name is Auto_Logo0 not Auto_Logo(). Image control does not have Locked property.

The form build wizard automatically creates this control. This is one reason why I don't use wizards - they do things I don't like.

Now I can say I have seen this control before, just never noted the name Access assigned. I usually ignore it as it is not relevant to issue. Yours is the first that factored in.

Switching off header/footer causes controls in that section to be deleted.
 
Last edited:

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
Nor do I use the wizard but I do copy and modify forms that do a similar job.
So it is not a function as I thought. My old eyes trick me sometimes.
Apart from on error etc is there a way to either delete the thing or otherwise ignore it when locking controls?
 

June7

AWF VIP
Local time
Today, 14:23
Joined
Mar 9, 2014
Messages
5,474
Delete just as you would any control.

To ignore would have to use code to check for it by name or type or Tag.
 

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
Delete just as you would any control.

To ignore would have to use code to check for it by name or type or Tag.
Tried that but there's no delete option in the dialog. I'll just have to settle for on error resume next for the time being. It seems to work ok but not my preferred method.
Thank you for your time.
John
 

June7

AWF VIP
Local time
Today, 14:23
Joined
Mar 9, 2014
Messages
5,474
Temporarily resize or move the button so you can click on the image control. Then press Delete key.

Those two buttons and the image control have been included in a group layout which makes them hard to resize and move individually. I don't use layout grouping.
 

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
Temporarily resize or move the button so you can click on the image control. Then press Delete key.

Those two buttons and the image control have been included in a group layout which makes them hard to resize and move individually. I don't use layout grouping.
Thanks again. I'll give it another go.
John
 

June7

AWF VIP
Local time
Today, 14:23
Joined
Mar 9, 2014
Messages
5,474
Or the right click > Delete should then be available.
 

John Sh

Member
Local time
Tomorrow, 08:23
Joined
Feb 8, 2021
Messages
410
Done.
I had to remove the layout first and then I was able to delete.
Many thanks, you've solved my problem.
 

June7

AWF VIP
Local time
Today, 14:23
Joined
Mar 9, 2014
Messages
5,474
Removing layout would make it easier but was not necessary.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:23
Joined
May 7, 2009
Messages
19,245
just add another "check" to your code:
Code:
Public Function lockAll()
    Dim frm As Form
    Dim ctl As Control
    If UserLevel = 3 Then    '  "userlevel" is set in a login form
        Set frm = Screen.ActiveForm
        For Each ctl In frm.Controls
            If TypeOf ctl Is TextBox Or _
                TypeOf ctl Is ComboBox Or _
                TypeOf ctl Is ListBox Or _
                TypeOf ctl Is OptionGroup Or _
                TypeOf ctl Is OptionButton Or _
                TypeOf ctl Is CheckBox Then
                
                If InStr(ctl.Name, "btn") = 0 Then
                    ctl.Locked = True    '  stops students from altering data
                End If
            End If
        Next ctl
    End If
End Function
 

Users who are viewing this thread

Top Bottom