Date update overflow error ‘6’

Tayl4n

Board Regular
Joined
Feb 17, 2021
Messages
68
Office Version
  1. 2016
Platform
  1. Windows
Dear MrExcel community,
I have a project search & update & add & delete can do.
There are 32 column and 5 of them is date.
When I search date format has changed automatically “dd.mm.yyyy” to “mm/dd/yyyy” and shows up to textbox with that wrong format.
I solved this with this code;

VBA Code:
txtU.Text = Format(txtU, “dd.mm.yyyy”
But this time update functions are broken for date textboxes. When I try to change a date on textbox this error shows up and date changin randomly ex. I press 2 and date changes to “01.01.1900”.
I feel confused. I use these codes for update;
VBA Code:
Sheets(“Worksheet”).Cells(y,1).Value = txtA
 

Tayl4n

Board Regular
Joined
Feb 17, 2021
Messages
68
Office Version
  1. 2016
Platform
  1. Windows
What problem? typing a 2 in is giving the correct answer... type the full date.
I wrote the problem in my first message.
The problem is; I makin search and get the datas to textboxes. There are 32 column and 5 of them are dates. I want to edit date with textbox and update. But when I press to date’s textbox and want to change date changes to “01.01.1900” and can’t edit.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,713
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
That sounds like a problem with your code, but you haven't posted it, other than one line, so it's very hard to comment.
 

Tayl4n

Board Regular
Joined
Feb 17, 2021
Messages
68
Office Version
  1. 2016
Platform
  1. Windows
That sounds like a problem with your code, but you haven't posted it, other than one line, so it's very hard to comment.
Everything is worked clearly before I add this
VBA Code:
txtU.Text = Format(txtU, “dd.mm.yyyy”
This is solve only showing date formats.
I can’t copy paste the all codes because there is no internet connection. I wrote codes with phone and its hard which parts do you need to comment ?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,713
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
I need to know which event is reformatting the textbox. If it's the Change event, don't use that. Use something like the Exit event of the textbox.
 

Tayl4n

Board Regular
Joined
Feb 17, 2021
Messages
68
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

I need to know which event is reformatting the textbox. If it's the Change event, don't use that. Use something like the Exit event of the textbox.
Yes it is work I can change and update but date shows on textbox as this time “mm/dd/yyyy” and it is making possibility to mistake.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,713
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You should only need to format it when you load the date into it.
 

Tayl4n

Board Regular
Joined
Feb 17, 2021
Messages
68
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

You should only need to format it when you load the date into it.
Yess that is exactly! But I don’t know alternative codes for format
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,713
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
The Format code is fine, it's where you use it that is the problem. It should only be used in the code that populates the textbox initially with the date value and, if necessary, something like the Exit event of your textbox.
 

Tayl4n

Board Regular
Joined
Feb 17, 2021
Messages
68
Office Version
  1. 2016
Platform
  1. Windows
The Format code is fine, it's where you use it that is the problem. It should only be used in the code that populates the textbox initially with the date value and, if necessary, something like the Exit event of your textbox.
code didn’t work in exit event also tried before update and after update there is mo results :(
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,713
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
It's impossible for me to help you if I can't see the code you are using, I'm afraid.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,842
Messages
5,638,676
Members
417,041
Latest member
Molo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top