Hi all,
I am building a userform that is capable of storing data in a sheet (called 'Database') in the same file. there is also functionality to search values per columns on the userform using a listbox to be able to select a row and then edit and submit the data again. This is where some problems arise regarding the date formatting.
I have 4 textboxes where the date is selected using a calendar. I want it to be in the format DD-MM-YYY. When i use my calendar to select a date it tastes the right date in the right format in the textbox, however if i the save my data it changes to MM-DD-YYYY if i look in the database. It does this only if it's possible: so let's say i put it in 7-9-2023, it changes to 9-7-2023, but 25-9-23 stays 25-9-2023. This is the first part of the problem. I have checked with changing the language / regional settings of the operating system but even if theyre set to DD-MM-YYYY it still changes it. Also changing the Excel language does not change anything. Is there anyway to make sure it always stores the right date/date format when saving the data?
Here is the part of the code that saves the data to the sheet after filling them on the userform. textboxes with the dates are txtWlevink, txtGlevink, txtWlevver, txtGLevver:
The second question is regarding the edit part of the userform. When trying to edit a row, it copies the data back to the userform when clicking edit after selecting a row in the listbox on the userform. When the dates are 'possible' in the US notation (such as 9-2-2023) are copied back as a 5 character number instead of the date. Is there any way to fix this?
this part of the code is responsible for editing:
basically the question is: How can i fix this so that when the computer and Excel are set to the Dutch format (DD-MM-YYYY) that the Database sheet and the userform only use that format? Different people need to use this file so even better would be if it always works when someone uses it even with different settings.
by the way:
i tried using
But that does not work
Bookmarks