Solved Row selection & Focus Issue in Datasheet Form

ahmad_rmh

Member
Local time
Today, 21:46
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: 114
Last edited:
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.
 
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.
 
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
 
The other fields must have properties
Enabled = False
Locked = True
 
How to do textbox selection property to false in datasheet form.
 
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
 
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.
 
Well I believe I have answered the question and provided a link to an example
 
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

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
 
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

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: 91
add code to Refresh the form:

Code:
Public Function fnMoveFocusToCheckField()
If Me.ItemID.Locked Then
    Me.Check.SetFocus
End If
Me.Refresh
End Function
 
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

Back
Top Bottom