Solved Row selection & Focus Issue in Datasheet Form (1 Viewer)

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
I have a datasheet form with all fields are locked and enabled field property false except one check field.

I want the selection of row should have to work as enabled property false.

screen shot is attached herewith.

kindly suggest.
 

Attachments

  • Capture.JPG
    Capture.JPG
    62 KB · Views: 59
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 19:55
Joined
Feb 28, 2001
Messages
27,223
Not quite sure what you are asking. Are you suggesting that a user should not be able to select one of the rows in the datasheet form? It would also help to know if you are talking about a O365 Web Datasheet View or a "native" datasheet view since they have different properties.
 

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
Access form, datasheet view

Elaboration of question:

The form has fields as following

Check box
Item Name
Paking size
Quantity on hand
and so on..

I am doing check box selection and the other fields are locked to make read only.

Now, if I will click on any locked field, the row selection works but in the locked fields cursor works and blinks.

After making setfocus for the check box field and making tabstop property false for locked fields but selection works for the locked fields.

So, what would be the possible solution.
 

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
Not quite sure what you are asking. Are you suggesting that a user should not be able to select one of the rows in the datasheet form? It would also help to know if you are talking about a O365 Web Datasheet View or a "native" datasheet view since they have different properties.

Sent elaboration in post # 3
 

CarlettoFed

Member
Local time
Today, 02:55
Joined
Jun 10, 2020
Messages
119
The other fields must have properties
Enabled = False
Locked = True
 

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
The other fields must have properties
Enabled = False
Locked
Then you couldn't move on row selection, you have just focus only one field

I want row selection should have to work on all fields
 

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
How to do textbox selection property to false in datasheet form.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:55
Joined
Feb 19, 2013
Messages
16,629
I think what you are saying is you want users to be able to select a row by clicking on any field but the focus not to to stay on that field.

if that is the case, in each fields got focus event you need code to set the focus to a unbound control. In a form this is not a problem but in data sheets, pretty sure you can’t do this - I’m on my phone to test so create an unbound control and try it. Otherwise try setting the focus to your checkbox.

edit - see this link for an example of moving focus
 

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
I think what you are saying is you want users to be able to select a row by clicking on any field but the focus not to to stay on that field.

if that is the case, in each fields got focus event you need code to set the focus to a unbound control. In a form this is not a problem but in data sheets, pretty sure you can’t do this - I’m on my phone to test so create an unbound control and try it. Otherwise try setting the focus to your checkbox.

edit - see this link for an example of moving focus

Yes, you are right as you said:

"I think what you are saying is you want users to be able to select a row by clicking on any field but the focus not to to stay on that field."

and as you said that "the focus should have to remain at check box" but the question is how to avoid focus and selection of other fields.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:55
Joined
Feb 19, 2013
Messages
16,629
Well I believe I have answered the question and provided a link to an example
 

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
Well I believe I have answered the question and provided a link to an example

I have attached the db file and screenshot of the locked field, I don't want selection of the locked fields in any case.

kindly suggest.
 

Attachments

  • Capture.PNG
    Capture.PNG
    15.8 KB · Views: 48
  • RowSelection.accdb
    456 KB · Views: 73

CJ_London

Super Moderator
Staff member
Local time
Today, 01:55
Joined
Feb 19, 2013
Messages
16,629
kindly suggest.
not clear what you want - the example you provided seems to do what you require.

Only refinements I can think of would be

by selecting a row you change the checkbox from true to false or false to true but that could be quite dangerous. Code would be

check=not check

Alternatively change the controls (except the checkbox) to enabled=false and locked =true but that will only change row by click on the check box, not by clicking on one of the other fields
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:55
Joined
May 7, 2009
Messages
19,247
is this what you meant.
see the code of form's current event.
on design view of form, see the Click and OnGotFocus event of each textbox.
 

Attachments

  • RowSelection.accdb
    424 KB · Views: 83

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
is this what you meant.
see the code of form's current event.
on design view of form, see the Click and OnGotFocus event of each textbox.

Thanks Arnel, 🌹 ❤️ 🌹
you got what I was requesting,

Kindly see the attached screenshot,

Why it's happening like that as highlighted in circle, the click focus making marks.
 

Attachments

  • Capture.JPG
    Capture.JPG
    49.3 KB · Views: 45

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:55
Joined
May 7, 2009
Messages
19,247
add code to Refresh the form:

Code:
Public Function fnMoveFocusToCheckField()
If Me.ItemID.Locked Then
    Me.Check.SetFocus
End If
Me.Refresh
End Function
 

ahmad_rmh

Member
Local time
Today, 03:55
Joined
Jun 26, 2022
Messages
243
add code to Refresh the form:

Code:
[CODE]Public Function fnMoveFocusToCheckField()
If Me.ItemID.Locked Then
    Me.Check.SetFocus
End If
Me.Refresh
End Function
[/CODE]

amended:

Code:
Public Function fnMoveFocusToCheckField()
If Me.ItemsPK.Locked Then
    Me.Check.SetFocus
End If
Me.Refresh
Screen.MousePointer = 1
End Function

Kindly suggest, Is it the correct way or not?
 

Users who are viewing this thread

Top Bottom