Having problems with tabs and text delition

alvarogueva

Registered User.
Local time
Today, 05:05
Joined
Nov 5, 2016
Messages
91
Well;

Hello there.

I have some major problems with my Database.

I have a Nav bar, where I have multiple taps where I make my data entry.

A problem I encounter a lot is that every time I select a tab, it selects a text box, and a lot of times either me or one of my employees erases the field, to later be notice and not knowing what was the information.

Is there a way to block edition but allow copy of text box information?

Also, a button to edit later the information, so if there is anything that changed, I can go ahead and change it in the form? LOL


THANK YOU GUYS!!
 
I suggest testing the textbox in the beforeupdate for being null or maybe even checking the old value against the new value. You could prompt the user to confirm the change so if it wasn't attentional they could choose an option to undo the change.
 
I suggest testing the textbox in the beforeupdate for being null or maybe even checking the old value against the new value. You could prompt the user to confirm the change so if it wasn't attentional they could choose an option to undo the change.

I love your ideas!! I just don't have any idea on how to code any of that. Do you see somewhere in the code an option for that?
 
My idea doesn't work out as well as I had imagined. I had hoped to give you some code that would undo a change in a specific field. When I tried using the textboxes' beforeupdate and canceling to undo the change it work nicely except when you close the form you get this weird message "you can't save this record at this time". There doesn't seem to be anyway to get rid of it.

What I was able to do is put some code in the form's beforeupdate that doesn't undo a specific field. If the user doesn't save the changes then the changes in all of the field are discarded. Maybe you can use it that way. Here's the code which you can see demonstrated in the attached database.

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNull(Me.F1) And Not IsNull(Me.F1.OldValue) Then
    If MsgBox("The value of " & Me.F1.OldValue & " has been erased." & vbCrLf & _
            "Do you want to save this change?", vbYesNo) = vbNo Then
        Me.Undo
    End If
 End If


If Me.F1.OldValue <> Me.F1.Value Then
    If MsgBox("The value of this textbox has change from " & Me.F1.OldValue & " to " & Me.F1.Value & vbCrLf & _
            "Do you want to save this change?", vbYesNo) = vbNo Then
        Me.Undo
     End If
End If

End Sub
 

Attachments

My idea doesn't work out as well as I had imagined. I had hoped to give you some code that would undo a change in a specific field. When I tried using the textboxes' beforeupdate and canceling to undo the change it work nicely except when you close the form you get this weird message "you can't save this record at this time". There doesn't seem to be anyway to get rid of it.

What I was able to do is put some code in the form's beforeupdate that doesn't undo a specific field. If the user doesn't save the changes then the changes in all of the field are discarded. Maybe you can use it that way. Here's the code which you can see demonstrated in the attached database.

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNull(Me.F1) And Not IsNull(Me.F1.OldValue) Then
    If MsgBox("The value of " & Me.F1.OldValue & " has been erased." & vbCrLf & _
            "Do you want to save this change?", vbYesNo) = vbNo Then
        Me.Undo
    End If
 End If


If Me.F1.OldValue <> Me.F1.Value Then
    If MsgBox("The value of this textbox has change from " & Me.F1.OldValue & " to " & Me.F1.Value & vbCrLf & _
            "Do you want to save this change?", vbYesNo) = vbNo Then
        Me.Undo
     End If
End If

End Sub

That is so nice from you, but i don't think that can help either. Most of my employees don't know the cntl+S to save documents or the database in this case. There gotta be a way that every time a tab is changed it doesn'5t go to a fiel steaight trought....
 
A problem I encounter a lot is that every time I select a tab, it selects a text box, and a lot of times either me or one of my employees erases the field, to later be notice and not knowing what was the information.
As a rule of thumb you should not be routinely editing data. If data changes over time, then the time dimension of those changes is commonly an important dimension to know something about. It is more common therefore to only ever add data, and add it with a date/time dimension.

Consider an Order object which has a status field. Maybe you commonly edit the status of an order, but there is a strong case to make to save each status change event into a table that records the date/time of that event. Then you can begin to understand how long your orders take in processing, and the current status of an order will always be the newest one.

You haven't said what data you are editing, but one solution to spurious errors in editing data is, don't edit data. Only add data. Events happen in time. Save the values of those events with that time dimension as an important part of your data. If you edit fields, information is always lost.

Hope this helps,
 
As a rule of thumb you should not be routinely editing data. If data changes over time, then the time dimension of those changes is commonly an important dimension to know something about. It is more common therefore to only ever add data, and add it with a date/time dimension.

Consider an Order object which has a status field. Maybe you commonly edit the status of an order, but there is a strong case to make to save each status change event into a table that records the date/time of that event. Then you can begin to understand how long your orders take in processing, and the current status of an order will always be the newest one.

You haven't said what data you are editing, but one solution to spurious errors in editing data is, don't edit data. Only add data. Events happen in time. Save the values of those events with that time dimension as an important part of your data. If you edit fields, information is always lost.

Hope this helps,

Hey MARK;

So, the data I am talking about could be refer as for example an address:

Box 1:1234 SW 12th Street
Box 2:Los Angeles,
Box 3:CA,
Box 4:24842

But, while tabbing between the tabs, their finger might slide and do this:

Box 1:
Box 2:Los Angeles,
Box 3:CA,
Box 4:24842

So what I am trying to do is While they are tabbing, there is no box selected, unless they click directly to it. So is that an After Click event, where When they click in a tab, gives null in selection? LOL I am a bit confused....
 
You can control whether the field is selected upon entry in the client options. You can set this programmatically, for example in the form load of your main form, with

Code:
SetOption "Behavior Entering Field", 1  '1 = Goto start of field

Just sets the cursor at the beginning of the field. At least that would prevent the deletion in the cases where their fingers are slipping onto the backspace key.
 
You can control whether the field is selected upon entry in the client options. You can set this programmatically, for example in the form load of your main form, with

Code:
SetOption "Behavior Entering Field", 1  '1 = Goto start of field

Just sets the cursor at the beginning of the field. At least that would prevent the deletion in the cases where their fingers are slipping onto the backspace key.

The form Load?

where I am suppose to put that code in? in the Navigation Form?? in Afterupdate?
 
You could put it in the Form load event of the Navigation Form.
 
You could put it in the Form load event of the Navigation Form.

Well that did not work... I have this as an event also...

"Private Sub TabCtl85_Change()
' If IsNull(Me.CustomerID) Then
' Me.TabCtl85.Pages.Item("Customer").SetFocus
' ElseIf IsNull(Me.CompanyF.Form![CompanyID]) Then
' Me.TabCtl85.Pages.Item("Company").SetFocus
' End If
End Sub"


Let me know....
 
Maybe you don't understand what it does and maybe it doesn't help but it does work. For it to make any difference the Client Setting Behavior enter field would have to be set to "Select entire field" That the default setting at least for Access 2013. In that case when the user tabs into a field the field is selected like:

attachment.php


If the user happens the press the backspace key the field is erased. To change this behavior so that the field is not select you only need to put the line I providedi in the Form Load event as show here:

attachment.php


Then when the user tabs into a field the field is not selected and the cursor is at the beginning of the field as shown below

attachment.php
 

Attachments

  • InFormLoad.jpg
    InFormLoad.jpg
    77.7 KB · Views: 302
  • SelectUponEnter.jpg
    SelectUponEnter.jpg
    73.7 KB · Views: 303
  • EnterAtStart.jpg
    EnterAtStart.jpg
    73.6 KB · Views: 329
On forms with things like addresses etc that are normally only set once and should only be viewed, I set the form to be locked, and have a "Add New" cmd button. This unlocks the fields for data entry and puts the form onto a new record. On some I have a added a "Save" button which simply re-locks the forms controls and put them back onto the main navigation controls. This saves trying to have two versions of the form (New and lookup view only). You can also only allow users with correct privileges to have the Add new button enabled.

Once the form is closed by default it is locked again when re-opened.
 
...while tabbing between the tabs, their finger might slide and do this:
Box 1:
Box 2:Los Angeles,
Box 3:CA,
Box 4:24842
But you haven't said what data is being edited when this accident occurs. An address is not likely to change very often, so why force your user to routinely tab through the address? What is the work-flow that is going on here? What data will be changed?
 
Maybe you don't understand what it does and maybe it doesn't help but it does work. For it to make any difference the Client Setting Behavior enter field would have to be set to "Select entire field" That the default setting at least for Access 2013. In that case when the user tabs into a field the field is selected like:

attachment.php


If the user happens the press the backspace key the field is erased. To change this behavior so that the field is not select you only need to put the line I providedi in the Form Load event as show here:

attachment.php


Then when the user tabs into a field the field is not selected and the cursor is at the beginning of the field as shown below

attachment.php

Well, I click on Form, then Open;

Then I went exacly where you went, and create the next:
Code:
Private Sub Form_load()
SetOption "Behavior Entering Field", 1  '1 = Goto start of field
End Sub

When I open a customer, it comes as you say at the beginning, but when I go to Company tab, it selects everything again.
I go back to the Customer tab, and now its at the email box.
So weird, I'ma doing anything wrong?
 
But you haven't said what data is being edited when this accident occurs. An address is not likely to change very often, so why force your user to routinely tab through the address? What is the work-flow that is going on here? What data will be changed?

well any data can be updated any time, because is not exact data, but at the same time, I don't want someone to erase an address, or a phone number, or anything by accident you know?
 
On forms with things like addresses etc that are normally only set once and should only be viewed, I set the form to be locked, and have a "Add New" cmd button. This unlocks the fields for data entry and puts the form onto a new record. On some I have a added a "Save" button which simply re-locks the forms controls and put them back onto the main navigation controls. This saves trying to have two versions of the form (New and lookup view only). You can also only allow users with correct privileges to have the Add new button enabled.

Once the form is closed by default it is locked again when re-opened.


I see what you mean. that is a really useful way to do it. I like steve's option, I guess we need to twitch it a bit lol
 
Well, I click on Form, then Open;

Then I went exacly where you went, and create the next:
Code:
Private Sub Form_load()
SetOption "Behavior Entering Field", 1  '1 = Goto start of field
End Sub

When I open a customer, it comes as you say at the beginning, but when I go to Company tab, it selects everything again.
I go back to the Customer tab, and now its at the email box.
So weird, I'ma doing anything wrong?

That's something other that the entering field behavior. If you tab to another field it doesn't select it. I don't know what causing the content of these controls to be selected. I'm stumped.

An ugly workaround would be to set the SelStarted of these control to zero when these fields get focus. You would have to do this for each of the subforms. Below I show it for the TrackF and CompanyF forms.

attachment.php
 

Attachments

  • SelectStart0.jpg
    SelectStart0.jpg
    72.7 KB · Views: 228
That's something other that the entering field behavior. If you tab to another field it doesn't select it. I don't know what causing the content of these controls to be selected. I'm stumped.

An ugly workaround would be to set the SelStarted of these control to zero when these fields get focus. You would have to do this for each of the subforms. Below I show it for the TrackF and CompanyF forms.

attachment.php

Omg... How I ma goign to even do that, if i can barely understand what you are saying....

You have my database, do you see any plausible problem? or do you see the problem itself?

Wouldn't be a good way to create a SELECT or DESELECT box that can actually lock all those boxes? so if I was going to change anything I need to go there and check the box to be able to do any editions, and it will lock it self out once someone changes customer or closes the database?
 
I suggest you create a backend you can upload, upload your database in a new thread where maybe some other forum member can help you.
 

Users who are viewing this thread

Back
Top Bottom