Solved prevent the user from showing the hidden fields (1 Viewer)

HASAN-1993

Member
Local time
Tomorrow, 00:21
Joined
Jan 22, 2021
Messages
89
I have a SubForm in some cases my code hides some fields (MyTextBox.ColumnHidden = True), but when the user tries to expand it, he can
 

Ranman256

Well-known member
Local time
Today, 17:21
Joined
Apr 9, 2015
Messages
4,337
make a query that excludes that field,
or
use a form that does not show the field box
 

HASAN-1993

Member
Local time
Tomorrow, 00:21
Joined
Jan 22, 2021
Messages
89
This option is not possible
Because the field can be used if the user chooses this option

But there is a condition for it to appear, an error that appears without the condition, so I want to Prevent the user
 

HASAN-1993

Member
Local time
Tomorrow, 00:21
Joined
Jan 22, 2021
Messages
89
I tried

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
if me.txtbox.ColumnHidden = true then
me.textbox.ColumnHidden = true
End If

But in this case, I can no longer move any other field
 

isladogs

MVP / VIP
Local time
Today, 22:21
Joined
Jan 14, 2017
Messages
18,253
Use a continuous form instead of a datasheet and don't allow users to change to design view
 

HASAN-1993

Member
Local time
Tomorrow, 00:21
Joined
Jan 22, 2021
Messages
89
Use a continuous form instead of a datasheet and don't allow users to change to design view
There are several reasons that prevent me from using continuous Form
is There a way to use datasheet View
 

isladogs

MVP / VIP
Local time
Today, 22:21
Joined
Jan 14, 2017
Messages
18,253
Datasheet forms are designed so that their appearance can be customised by end users including rearranging fields, hiding columns and showing hidden columns. However you can set Shortcut Menu = No on the form property sheet. That will disable the right click menu and limit what users can do

However, a continuous form provides more control on what users can/can't do and can be made to look almost identical to a datasheet.
What the the "several reasons that prevent you from using a continuous form"?
 

HASAN-1993

Member
Local time
Tomorrow, 00:21
Joined
Jan 22, 2021
Messages
89
After a deep reflection I found the solution
to whom it may concern

Me.Mytextbox.ColumnHidden = True
Me.Mytextbox.Enabled = False

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Me.Mytextbox.Enabled = False Then
Me.Mytextbox.ColumnHidden = True
End If
End Sub
 

isladogs

MVP / VIP
Local time
Today, 22:21
Joined
Jan 14, 2017
Messages
18,253
I think you will find that users will still be able to reverse that code.
Did you notice my comment in post #8
 

HASAN-1993

Member
Local time
Tomorrow, 00:21
Joined
Jan 22, 2021
Messages
89
I think you will find that users will still be able to reverse that code.
Did you notice my comment in post #8
You are correct, but I used my Custom shortcut menu
But the problem was that if the user placed the mouse between the fields and expanded the field, then he can, if you try that, you will know what I say
 

isladogs

MVP / VIP
Local time
Today, 22:21
Joined
Jan 14, 2017
Messages
18,253
You are correct, but I used my Custom shortcut menu
But the problem was that if the user placed the mouse between the fields and expanded the field, then he can, if you try that, you will know what I say
I don't have a copy of your app but, yes I am aware of what you are saying
That's why I would either disable the shortcut menu (including your own custom menu) or use a continuous form as already stated.

Anyway, if you're happy, that's all that matters! Good luck with your project
 

HASAN-1993

Member
Local time
Tomorrow, 00:21
Joined
Jan 22, 2021
Messages
89
I don't have a copy of your app but, yes I am aware of what you are saying
That's why I would either disable the shortcut menu (including your own custom menu) or use a continuous form as already stated.

Anyway, if you're happy, that's all that matters! Good luck with your project
Ok now, I no longer have to disable my custom menu

thanx
 

anski

Registered User.
Local time
Tomorrow, 05:21
Joined
Sep 5, 2009
Messages
93
However, a continuous form provides more control on what users can/can't do and can be made to look almost identical to a datasheet.
What the the "several reasons that prevent you from using a continuous form"?
Is there a way that I can jump to another record (either previous or next rows) without having to go through all the fields for the row where my cursor is currently on without using the mouse (just using the arrow keys)?
 

isladogs

MVP / VIP
Local time
Today, 22:21
Joined
Jan 14, 2017
Messages
18,253
Is there a way that I can jump to another record (either previous or next rows) without having to go through all the fields for the row where my cursor is currently on without using the mouse (just using the arrow keys)?
This question should really be in a new thread to get a wider audience
In a datasheet, just use the Up or Down arrows.
In a continuous form, that can be done only by changing the tab options
 

Users who are viewing this thread

Top Bottom